Roche (Sky) and Zubeldia (Trek Factory Racing) separated themselves from the giant break of the day with 15km to race and worked together to decide the stage, with Roche taking the spoils.
Third was Jose Gonçalves (Caja Rural-Seguros RGA) ahead of the bunch sprint which included all of the favourites, including race leader Tom Dumoulin (Giant-Alpecin) and Fabio Aru (Astana).
The general classification remained unchanged with Dumoulin leading Aru by three seconds. Joaquim Rodriguez (Katusha) is third overall.
"There was a rider 20 seconds behind and when we saw that I just said 'let's just ride to the finish and we'll do a mano a mano sprint'," Roche said after the stage
"It was actually really good and we co-operated well since the 15km to go sign. I think that was our only chance."
The 204km 18th stage from Roa, which included the 1st category Puerto de la Quesera climb 13km before the finale into Riaza, was always likely to be one for a breakaway rider to win.
It took over an hour before the breakaway formed: when it did 25 riders, including Roche, Zubeldia, Gonçalves and Australia's Adam Hansen (Lotto-Soudal), formed a lead which eventually stabilised at 5min 30sec.
Astana took on the task of keeping the break under control as they attempted to put race leader Dumoulin under pressure to make up second-placed Fabio Aru's three-second deficit to the Dutchman.
Cyril Gautier (Europcar) attacked the break to go solo from 25km out but his heroics lasted only a few kilometres.
Meanwhile, the general classification battle exploded into activity. with attacks from Rodriguez, Aru and Esteban Chaves (Orica-GreenEDGE). However, all were nullified as race leader Doumoulin calmly covered every move.
From the break, Roche and Zubeldia were the next to assume the stage lead, with the pair cresting the Puerto de la Quesera 55 seconds ahead of Dumoulin and the rest of the contenders.
They held their lead through the descent and entry into Riaza, with Roche using his superior finishing speed to emerge as the winner ahead of Zubeldia.
The stalemate in the GC battle means eyes now look to Friday's stage and the short cobbled ascent into Avila. While time gaps are unlikely to be large, time bonuses could make a difference, especially if Aru can finish ahead of Dumoulin.
However, Dumoulin is looking composed in the red jersey, even putting in a small attack of his own ahead of today's finish.
"I could handle those attacks." Dumoulin said to Spanish TV after the stage. "I knew [Aru] had spent some energy, so when [Dani] Moreno [Katusha] tried a move late on, I made a counter-attack of my own."
"I always kept Aru's wheel, even when it got steeper," he adds. "There are three stages left, three days, so I can lose one second a day."