Thomas Mueller scored twice and set up another goal as Germany beat Scotland 3-2 to move to the brink of qualifying for Euro 2016 after all but securing a top-two finish in Group D with two games left.

The Germans have 19 points while Poland, who crushed Gibraltar 8-1, are on 17.

Ireland, who beat Georgia 1-0 and next face Joachim Loew's team in October, are third with 15.

The 25-year-old Mueller struck in the 18th minute with a deflected effort and added another with a close-range header after Scotland had levelled with a Mats Hummels own goal.

The home team came back once more before halftime with a shot from James McArthur but Mueller rode to the rescue again, cutting the ball back for Ilkay Guendogan to fire the winner in off the post in the 54th minute.

Elsewhere, Robert Lewandowski, Kamil Grosicki and Arek Milik all scored twice as Poland bounced back from last week's defeat by Germany to flatten Gibraltar.

Poland were 2-0 up in the opening 15 minutes [EPA]

Grosicki struck twice in the opening 15 minutes before another quickfire double from Lewandowski put the Poles 4-0 up by halftime.

Milik was on target twice in the second half while Jakub Blaszczykowski added a penalty and Bartosz Kapustka also netted.

Gibraltar, UEFA's newest international team, fielded just one professional player - Jake Gosling of Bristol Rovers - and he scored a consolation goal in the 87th minute.

Meanwhile, a stoppage-time header by defender Miguel Veloso gave Portugal a 1-0 win in Albania and allowed them to extend their lead on top of Euro 2016 qualifying Group I.

The Portuguese have 15 points from six games, ahead of Denmark who have 12 from seven after a 0-0 draw in Armenia.

Third-placed Albania have 11 points from six games and despite the setback are assured of at least a play-off berth.

Results:

Poland 8-1 Gibraltar

R. of Ireland 1-0 Georgia

Scotland 2-3 Germany

Finland 1-0 Faroe Islands

Northern Ireland 1-1 Hungary

Romania 0-0 Greece

Armenia 0-0 Denmark

Albania 0-1 Portugal

Source: Reuters