Germany completed their preparations for the World Cup with a 2-1 win over Saudi Arabia in Leverkusen.
Joachim Low’s side brought to an end five matches without a victory – their worst run of form since 1988.
However, despite dominating for most of the game at the BayArena after taking an early lead through Timo Werner, the world champions could have ended up with an embarrassing draw after Saudi Arabia’s late revival.
After Omar Hawsawi’s own goal doubled Germany’s lead, Taisir Al-Jassim set up a nervy final six minutes.
Arsenal midfielder Mesut Ozil sat out the match as a precaution because of a left knee problem.
Low, however, was seeking an improved performance following the loss to Austria in Klagenfurt, so named a strong starting XI.
Marco Reus and Julian Draxler were given a chance to impress, with Thomas Muller on the right and RB Leipzig forward Werner leading the attack while Bayern Munich goalkeeper Manuel Neuer continued his recovery from a foot injury.
Germany, who open the defence of their World Cup crown against Mexico in Moscow on June 17, went ahead in the eighth minute.
Reus took a long pass from Joshua Kimmich first time in the left side of the penalty area and cut back for Werner, who crashed the ball in off the underside of the crossbar.
Germany were denied a second by the woodwork as Reus, back from his own extended injury lay-off, fired a 20-yard effort past the Saudi keeper but against the left-hand post.
The ball was in the Saudi net again after 25 minutes when Reus converted Sami Khedira’s diagonal pass, but the Borussia Dortmund player was flagged offside.
Khedira was then denied by a fine reaction save by Saudi goalkeeper Abdullah Al-Mayoof.
At the other end, striker Fahad Al-Muwallad sent a low shot just wide.
Germany saw another goal ruled out for what looked a marginal offside call at best, when Draxler fed Muller for a close-range finish.
The hosts finally saw something count two minutes before half-time when defender Hawsawi turned a cross from Werner into his own net.
Marc-Andre ter Stegen replaced Neuer in the Germany goal for the second half.
Muller tested the Saudi keeper again with a turn and shot from the edge of the penalty area, before Manchester City midfielder Ilkay Gundogan, on as a substitute, had two efforts saved.
Al-Mayouf beat away a long-range effort from Muller before Saudi Arabia were awarded a penalty with six minutes left after Khedira was adjudged to have pulled down Al-Jassim.
Barcelona goalkeeper Ter Stegen saved Mohammad Al-Sahlawi’s poor spot-kick, but Al-Jassim was alert to knock in the rebound.
Saudi Arabia, who open the tournament against hosts Russia at the Luzhniki Stadium on June 14, almost snatched a dramatic equaliser in the final minute.
Al-Jassim was played in behind down the left, but opted to cross and Al-Sahlawi went down under a challenge from Mats Hummels – the German appearing to pull his shirt as the referee waved away appeals for another penalty.