Gillingham, bottom of League Two, frustrated their Premier League hosts until the 77th minute — when sub Raul Jimenez came to the rescue.
The striker had not played for Wolves since August because of a groin injury.
But he had been to the World Cup with Mexico — and needed just eight minutes to mark his return with a goal that eased Molineux nerves.
Gills defender Cheye Alexander was judged to have pulled back Hwang Hee-chan at a corner and ref Michael Salisbury pointed to the spot.
Hitman Jimenez coolly netted the penalty.
It was tough on the Kent visitors, who had beaten Brentford in the previous round.
But Wolves sealed the tie and a spot in the quarter-finals with a second in injury-time as Hwang set up sub Rayan Ait-Nouri.
Lopetegui was given the Wolves job more than six weeks ago, but he did not officially begin his reign until the beginning of the World Cup break.
The Spaniard’s first team selection saw him pick a strong side — but it was a game of pure frustration for Wolves.
CASINO SPECIAL – BEST NEW CUSTOMER SIGN UP DEALS
Midfielder Ruben Neves, back from the World Cup with Portugal, went close with a 20-yard free-kick and, three minutes before half-time, Goncalo Guedes crossed for Joe Hodge, who headed wide.
Neves then struck the post from the edge of the area. But there was an anxious spell after the break, with Wolves fans getting on their team’s back before they finally came out on top.
Lopetegui was given a worrying baptism — but the real tests lie ahead in the Premier League.
Elsewhere in the cup, Newcastle, Leicester and Leicester made it a clean sweep for Prem clubs against lower-league sides.
Adam Smith headed the only goal past his own Bournemouth keeper at St James’ Park, following a brilliant cross from teh Toon’s England right-back Kieran Trippier.
The Foxes found it easy, Youri Tielemans and Ayoze Perez putting them in control at MK Dons before Jamie Vardy nodded home early in the second period in a 3-0 win.
And Nathan Jones notched his firrst victory as Saints’ boss – after surving a scare at home to League One Lincoln.
Southampton keeper Gavin Bazunu blundered for a second-minute own goal from a miscued clearance by Ainsley Maitland-Niles.
But Che Adams netted on 25 and 74 minutes as the Saints won 2-1 and netted more than once for the only time since beating Chelsea on August 30.
- WOLVES are set to sign £40million-rated Brazil forward Matheus Cunha from Atletico Madrid — as Lopetegui starts his January rebuild.
Cunha, 23, is due to come to Molineux on loan for the rest of the season.
He would be Lopetegui’s first signing as boss — and it could lead to a permanent deal.