The Dane was overtaken by David Gaudu (Groupama-FDJ) on Tuesday, but quickly returned to the overall lead as Visma finished second in Figueres.
UAE co-leaders Juan Ayuso and Joao Almeida were the big winners of the day in the general classification as they took eight seconds back on Vingegaard and moved into second and third, respectively.
"I think we did really well. I think we might have made some small mistakes out there. I heard from the split times that we drove relatively slowly in the middle part, so whether we could have done anything differently … it's hard to say. But it's at least something we need to look at."
"But we can't change it now, and I still think we did incredibly well. We are second and one man short of the other teams. I think we can be satisfied with that", said Vingegaard to TV 2 Sport.
Although team time trials are now quite rare on Grand Tours, the format is making a comeback, with the time for each team considered when the fourth rider crossed the line on the 24.1 km stage in Figueres.
Gaudu was level on time with race favourite Vingegaard after stage four, but the Frenchman took the leader's red jersey on countback. However, Visma-Lease a Bike turned the tables on Wednesday.
UAE Team Emirates-XRG finished with a time of 25 minutes and 26 seconds, averaging nearly 57 km/h, while Visma-Lease a Bike finished eight seconds behind. Groupama-FDJ could only manage ninth place, 24 seconds behind.
Vingegaard now holds an eight-second lead over the UAE Team Emirates-XRG trio of Juan Ayuso, Joao Almeida and Marc Soler. Lidl-Trek's Giulio Ciccone is nine seconds back while Gaudu is 16 seconds behind in the general classification.
The Israel-Premier Tech team were stopped on the road by a group of protesters holding Palestinian flags, with half the team forced to a complete stop before they set off again.
The protest cost them several seconds, with the team eventually finishing 19th, 54 seconds slower than UAE Team Emirates-XRG.