BERLIN (AP) Germany and Portugal closed in on European Championship qualification on Monday, while Northern Ireland missed the chance to book its place at next year's tournament in France.

Thomas Mueller scored twice and set up the other for Germany to defeat Scotland 3-2 in Glasgow and move within touching distance of automatic qualification.

The world champions are assured of at least a playoff place but one point from their remaining two games - Ireland away or Georgia at home - will secure their place in France.

More from FoxSports

Portugal also needs just one more point after Miguel Veloso scored in injury time to snatch a 1-0 win at Albania.

The top two finishers from the nine groups qualify automatically for Euro 2016. The best third-place team also qualifies automatically, and the eight remaining third-place teams go to a playoff to contest the last four qualifying places.

Here is a look at Monday's Euro 2016 qualifying matches:

GROUP D

Mueller scored twice in the first half either side of Mats Hummels' own goal, and then set up Ilkay Gundogan for the winner after James McArthur had pulled Scotland level again.

Mueller now has five goals in three Bundesliga games for Bayern Munich and three goals in two qualifiers for Germany since the season began.

''I feel good,'' Mueller said.

Also, Poland routed Gibraltar 8-1 to stay on course for a top-two finish, while John Walters' 69th-minute goal was enough for Ireland to boost its hopes of a playoff with a 1-0 win over Georgia in Dublin.

Ireland, which next plays Germany at home then Poland away, has a five-point lead over Scotland, which plays Poland at home then Gibraltar away.

GROUP F

Northern Ireland needed an injury-time goal from Kyle Lafferty to draw 1-1 at home against Hungary after going down to 10 men.

A win would have ensured automatic qualification, but the draw leaves the team still top of the group.

Hungary looked like closing to within a point of the leaders when Richard Guzmics volleyed in from close range in the 74th minute after goalkeeper Michael McGovern spilled a free kick. Chris Baird was then sent off for Northern Ireland, but Hungary couldn't hold out and stayed four points back in third.

''It wasn't vintage,'' Northern Ireland manager Michael O'Neill said, ''but it was pure theater.''

Romania drew 0-0 at home to last-place Greece and remained second, a point behind Northern Ireland.

Also, Finland beat Faeroe Islands 1-0

GROUP I

Both Portugal and Albania hit the woodwork before Veloso headed in substitute Ricardo Quaresma's pass for the visitors' 92nd-minute winner.

It ensured that Portugal made it six wins from six road games in qualifying and brought a measure of revenge for the side's shock defeat to Albania in Aveiro in the opening round.

Elsewhere, Denmark was stymied at Armenia for a second 0-0 draw in four days, complicating the Danes' chances to secure a berth for the 2016 tournament with a top-two finish.

Portugal increased its group lead to 15 points. Denmark has 12 while Albania has 11, but both Portugal and Albania have a game in hand.

Armenia moved onto two points with the draw with Denmark. Serbia is in last place with one point.