Cilic trailed 4-1 in the decisive tiebreaker before coming back to clinch a 5-7, 6-3, 7-6 (5) victory after 3 hours, 13 minutes and secure a 2-0 win for Croatia over Spain.
Borna Coric upset Roberto Bautista Agut 6-4, 7-6 (4) in the first singles match to give Croatia the lead. It was Croatia's first Davis Cup victory over Spain after three previous defeats, and sets up a semifinal against Australia.
"It's an incredible effort by the team," Cilic said. "It's such a great privilege and honor to bring another point for the team Croatia and seal the win against the always strong Spanish team."
Cilic, the 2014 U.S. Open winner, hit 20 aces in the match but also produced 15 double-faults in a victory that improved his Davis Cup singles record to 33-15. Hi double-faulted twice in the 11th game of the first set as he was broken, but went 4-2 up in the second set to start his comeback after Carreno Busta hit a double-fault on his own on break point.
Coric and Cilic were both on the Croatian team that won a second Davis Cup title for their country in 2018.
Earlier, Coric sealed the win over Bautista Agut with his 12th ace on his third match point to silence the partisan crowd.
"I like the big stage, I like the big crowd," Coric said about the 7,500 noisy fans. "It gives me an extra motivation."
Bautista Agut had just one break point in the match and couldn't convert it.
"Today, I felt very, very well on the serve and I think in the end that's what made the difference," Coric said.
Two climate change activists briefly interrupted the second set by running onto the court. They were taken away by security officials.
The quarterfinals wrap up Thursday, when the U.S. meets Italy, and Canada plays Germany. The semifinals are Friday and Saturday, and the title will be decided Sunday. Each matchup involves two best-of-three-set matches in singles and one in doubles.