Borja Viguera had given the visitors a shock lead in the 17th minute but Adriano equalised 10 minutes before the break at the Nou Camp.
Villa scored a second-half brace as Tito Vilanova's side eased to a 6-1 aggregate win to progress to the fifth round.
It was the Spain international's 39th strike for Barca and the seventh of what has so far been a frustrating campaign for the former Valencia frontman.
Barcelona have been wary of overusing Villa, who spent eight months out with a broken tibia, and on Thursday was the first time this season he played the whole game.
"I have not played 90 minutes. The 301 goals make you think that you've done well and makes you feel proud to have achieved many goals," the striker said after the match.
Vilanova hinted that Villa could be given more first-team opportunities in the coming weeks.
"I think David has been fine, has scored twice and has completed 90 minutes," the boss told reporters.
"He has been playing regularly and every day I see an improvement. He has worked extensively with (physio) Emili Ricart over the summer.
"Every day I see him do better. We try to give him every minute possible."
An ankle injury has delayed Villa from making a full recovery and the striker feels he is ready for more action.
"There has been a small break in terms of recovery. But it's normal, I'm recovered and I've trained well all week," he said.
"I have always felt important, even when injured. Always (Barcelona) have shown me much love."
He repaid some of that affection on Thursday on what turned out to be a tricky night for the current Primera Division leaders.
Alaves top the Segunda Division and they certainly took the confidence gained by their impressive start to Catalunya.
"They played very well," Villa said. "They have proven to be a great team and came to the Camp Nou to enjoy themselves. We struggled a lot in the first half and it has been a tough game despite the result (3-0 Barcelona) going there."
Vilanova was surprised by Alaves' approach to the contest, believing they would play a more defensive system.
"They played different than how they have been playing regularly and I had to make changes," he said.
"They played two more midfielders so we could exploit them down the sides. There are no easy games but people think otherwise."