The building in Muhaisnah 4 had suffered structural damage last week and has been sealed off as authorities conduct investigations
"I needed this victory," said Valverde on the Vuelta website. "I had winning legs and I fancied victory today."
The 183.2km stage from Onda ended with a brief but brutal 4.1km climb which quickly split the pack.
With three kilometres to go, Nairo Quintana accelerated and was followed by only Movistar team-mate Valverde, Primoz Roglic of Jumbo-Visma and Astana's Lopez.
"I think in the end we saw who were the riders one step above the rest," Colombia's Lopez said.
Lopez's compatriot Quintana set the pace until the final kilometre, creating the springboard for his Spanish team-mate. Valverde, riding his home tour wearing the world champion's rainbow jersey, charged for the line in the final metres.
"It's even more special with the rainbow jersey," said Valverde. He also thanked Quintana but said the plan had not entirely worked.
"We wanted to drop Primoz Roglic and 'Superman' Lopez, but they were very strong too and it just wasn't possible," he said.
Valverde was chased home by Slovenian Roglic.
"A short but sweet climb and we know Valverde is good at this," Roglic told Eurosport.
Lopez rolled in six seconds later, expending less energy but still ensuring he regained the overall lead from Belgian Dylan Teuns, who struggled on the climbs.
Quintana was fourth having also done his job for his team.
After the stage, those four top the overall standings. Lopez is six seconds ahead of Roglic with the 39-year-old Valverde 16 back and Quintana at 27.
"There is a lot of La Vuelta left, but it seems today's top four are the strongest of the race at this point," said Valverde.
At 39, Valverde became the third oldest stage winner in any of the three Grand Tours, following American Chris Horner, who won a Vuelta stage at 41 in 2013, and Belgian Pino Cerami who was also 41 when he won on the 1963 Tour de France.
In a race so far marked by breakaways, Saturday's eighth stage is a hilly 166.9km ride from Valls to Igualada where the flat finish could give the sprinters a chance, if the pack stays together.
The building in Muhaisnah 4 had suffered structural damage last week and has been sealed off as authorities conduct investigations
Al Ain, which knocked out Cristiano Ronaldo's Al Nassr in the quarterfinals, reached the final for the first time since 2016
Defeat leaves Chelsea still in ninth, three points adrift of the European places
Liverpool left some key players out of their starting line-up for Sunday's 3-1 win at Fulham
Stoinis hit a match-winning unbeaten 124 for Lucknow Super Giants against Chennai Super Kings
It was Stoinis' first IPL century and his second in T20 cricket
Company’s showcase includes demonstrations of Copilot for Security
The museum to offer visitors the chance to take part in dance, yoga and work-out sessions while gazing upon paintings and sculptures