Germany swept to the brink of a place in the 2012 European Championship with a seventh straight qualifying win Tuesday, while Zlatan Ibrahimovic's hat trick in a 5-0 rout of Finland kept Sweden in the hunt for top spot in its group.

Real Madrid playmaker Mesut Oezil scored one goal and set up another as Germany beat Azerbaijan 3-1 in Baku, leaving Joachim Loew's side needing two points from its last three Group A games to guarantee a spot in next year's tournament in Poland and Ukraine.

Ibrahimovic inspired Sweden to a fifth win in six Group E matches, the AC Milan striker coming off the bench to score three times in 22 minutes to help lift his country three points behind the Netherlands.

World and European champion Spain followed up a 4-0 thrashing of the United States on Saturday with a 3-0 win against Venezuela, but fellow European heavyweight Italy was upset 2-0 by Ireland in Liege, Belgium, in another friendly.

In other Euro 2012 qualifiers, Hungary stayed three points behind Sweden thanks to a 3-0 win in San Marino, Belarus beat Luxembourg 2-0 to close to within a point of Group D leader France, and there were also wins for Bosnia-Herzegovina and the Faeroe Islands.

Germany, one of three countries with perfect records in qualifying along with Spain and the Netherlands, moved 10 points clear of second-place Belgium. Only Turkey - a point further back but with a game in hand - can stop Loew's men finishing top.

''It was important to win and to end the season with the seventh win. It was a perfect season,'' Germany captain Philipp Lahm said.

Oezil crashed an angled shot into the net off the post in the 30th minute to open the scoring before setting up striker Mario Gomez for the second goal 11 minutes later.

Murad Huseynov scored for Azerbaijan, which is managed by former Germany coach Berti Vogts, in the 89th, but Andre Schuerrle sealed victory for the visitors in injury time.

Ibrahimovic was a substitute after only recently recovering from an ankle injury but came on in the 25th as a replacement for the injured Ola Toivonen, with Sweden already 1-0 up through Kim Kallstrom's goal in the 12th.

After taking the captain's armband, Ibrahimovic slotted a low finish into the bottom corner in the 31st following a slide-rule pass from Kallstrom. He then stroked the ball into an empty net four minutes later after Sebastian Larsson's cutback.

The former Barcelona and Inter Milan striker clinched his hat trick with a free header at the back post from Kallstrom's inswinging 53rd-minute free kick, before setting up Emir Bajrami for Sweden's fifth in the 82nd.

Fresh from scoring for Barcelona in a 3-1 victory over Manchester United in the Champions League final 10 days ago, strikers David Villa and Pedro Rodriguez set an understrength Spain on its way to a convincing win in Venezuela with first-half goals.

Real Madrid midfielder Xabi Alonso added the third on the stroke of halftime as Spain coach Vicente del Bosque set a record for wins at the helm of the national team, his 39th surpassing the total achieved by predecessor Luis Aragones.

Keith Andrews and Simon Cox scored either side of halftime for Ireland, whose coach Giovanni Trapattoni got one over Italy counterpart Cesare Prandelli, who he used to manage when in charge of Juventus in the early 1980s.

In other friendlies, Norway defeated Lithuania 1-0 and Austria won 3-1 against Latvia, which ended the match with eight men after three late sending-offs.

The other four Euro 2012 qualifiers on Tuesday featured teams with only outside chances of gaining automatic qualification as group winners, although second-half goals from Sergei Kornilenko and Anton Putilo eased Belarus to a win over Luxembourg that kept the pressure on France, which has a game in hand over its closest rival.

Bosnia-Herzegovina, a 2-0 winner at home to Albania thanks to goals by Haris Medunjanin and Darko Maletic, is two points further back in Group D and has played six games like France.

Zoltan Liptak, Imre Szabics and Vladimir Koman were the scorers for Hungary against San Marino, which remains without a point or a goal in qualifying.

Faeroe Islands earned a maiden victory in Group C and a first three-point haul since 2009, beating Estonia 2-0 through goals from Frodi Benjaminsen and Arnbjorn Hansen.