Madrid had looked in control for long spells, but a late Talavera fightback forced Xabi Alonso's side to dig deep to avoid a shock exit from the competition.
Mbappe opened the scoring in the 41st minute after converting a penalty, before Madrid extended their lead in first-half stoppage time when Talavera defender Manuel Farrando turned the ball into his own net following pressure involving the France forward. Mbappe then struck again late in the second half with a powerful effort from outside the area to seal the win.
The brace took Mbappe to ten goals in his last six matches in all competitions for Madrid, underlining his growing influence in decisive moments.
"He was decisive," Alonso said. "Kylian has that knack for scoring. The third goal was key, which is why we kept him on the pitch and why he started."
Talavera refused to go quietly. Nahuel Arroyo pulled one back in the 80th minute and Gonzalo Di Renzo scored in stoppage time, setting up a frantic finish. Madrid goalkeeper Andriy Lunin produced a crucial save in the final minute to preserve the victory.
"In the first half, we controlled the game well and took the lead, but not making it 3-0 left the game open," Alonso said. "The second half was competitive. It was an exciting tie. Objective achieved, and on to the next game."
Madrid had rested several regular starters and will close out 2025 with a La Liga trip to Sevilla on Saturday.
Atletico edge thriller as giants fall
Antoine Griezmann scored in each half as Atletico Madrid edged past Atletico Baleares 3-2 in a tense away tie. Giacomo Raspadori also scored for Diego Simeone's side, who survived sustained late pressure. Baleares missed an 80th-minute penalty before scoring again in the 90th minute.
It was Atletico's third straight win in all competitions, with the club sitting fourth in La Liga behind Villarreal.
Villarreal, despite being third in the league and enjoying one of their strongest campaigns in years, were eliminated 2-1 by lower-tier opposition. Juan Carlos Arana scored twice before Ayoze Perez pulled one back late on, but the comeback fell short.
Celta Vigo were knocked out by Albacete after losing 3-0 on penalties following a dramatic 2-2 draw, while Levante lost 1-0 to Cultural Leonesa. In an all-top-flight clash, Alaves beat Sevilla 1-0 thanks to a late Carlos Vicente penalty.
Earlier in the week, Barcelona progressed with a 2-0 win over Guadalajara, while Real Sociedad and Valencia also advanced.