In a landmark performance, Omrzel of the Bahrain Victorious team also leapt up the overall standings, evoking memories of his countryman Tadej Pogacar's performance in his first Grand Tour in 2019.
Omrzel jumped to sixth overall, just 30 seconds behind Briton Oscar Onley in the best young rider white jersey category.
"I can't believe what I did, but I felt super good. I'm still feeling okay; I'm not tired. So I'm just enjoying it at the moment," Omrzel said.
Pogacar was six months older than Omrzel when he came third and won three stages in the 2019 edition of the Vuelta.
Movistar rider Mas finished 2min 56sec adrift of the winner but extended his overnight lead of 1:18 on Primoz Roglic by a further 27sec.
Four-time champion Roglic, another Slovenian, crossed the line with Felix Gall, who is third overall.

Following the two previous stages where the GC rivals played second fiddle to either the escape artists or the sprinters, the Vuelta returned to the mountains on stage 12 with a run of 166km that was contested in searing heat over five climbs to Calar Alto.
Mas has won the Vuelta white jersey twice, in 2018 and 2020, and is set for his first Grand Tour win if he can hold on.
Pogacar had been leading the Vuelta by almost four minutes but crashed out on stage eight, breaking his collarbone in what may be a season-ending injury.
The race ends in Andalusia next weekend with stages in the mountains and hills around Malaga and Granada's Sierra Nevada.
