The Chelsea striker earned praise from his manager after guiding La Roja to an 8-0 win over their Group G opponents on Monday evening
Costa has been struggling to find his best form while playing for the national team and had scored just once for Spain heading into the match in Leon.
The Chelsea striker netted twice to help his country to victory in Group G, though, and Lopetegui hailed his performance.
"In the end, the players are all master of their own destiny," Lopetegui said at a news conference. "We try to help the players, but Diego is a great player and he showed as much today [Monday].
"Of course, attackers are judged on so much more than goals, but we are happy for Diego - and for Alvaro - that he scored two goals."
Costa took aim at the Spanish press for their harsh attitude toward him after last week's friendly win over Belgium, but he was in a significantly better mood on Monday after taking his Spain tally to three.
"Not just the coach, but my team-mates always support me as well," Costa said.
"I can only thank my team-mates. They never let me down and always support me.
"Things are going well for me at the moment.
"Sometimes bad things happen and an attacker needs goals. I got involved more and I knew the goals would come."