Russia qualified for the World Cup for the first time in 12 years by drawing 1-1 with 10-man Azerbaijan on Tuesday.

Russia finished on top of Group F with 22 points, one point ahead of second-place Portugal which beat 10-man Luxembourg 3-0 and will go into next month's European playoffs for a berth in Brazil.

The Russians last qualified for the World Cup in Japan and South Korea in 2002, but under coach Fabio Capello they quickly secured the group's top spot and held it as Portugal once again came up short.

''Russia was the best team. They were better than us,'' Portugal coach Paulo Bento said. ''We needed to demonstrate better quality if we wanted the top spot.''

In Baku, Roman Shirokov gave Russia the lead in the 16th minute from a cutting pass from Alexander Samedov. Vagif Javadov headed in the equalizer in the 90th.

Azerbaijan was reduced to 10 men in the 73rd when Maksim Medvedev was given a red card for a rough tackle.

Portugal also had to go through the playoffs to qualify for its last two major tournaments, the 2012 European Championship and 2010 World Cup. It was a semifinalist at Euro 2012.

The Portuguese have been dogged by inconsistency. They have won just eight of their 16 qualifiers and friendly games since Euro 2012. Their qualifying campaign was spoiled by a 1-1 home draw against Northern Ireland and two draws against Israel.

Portugal, playing without suspended Cristiano Ronaldo in Coimbra, struggled to find a way through the Luxembourg defense until Aurelien Joachim was shown a straight red card for a high tackle on Andre Almeida in the 28th.

Two minutes later, Joao Moutinho set up Silvestre Varela for his fourth international goal. Nani made it 2-0 in the 36th after Moutinho set him up with a neat backheel.

Helder Postiga made it 3-0 in the 78th, making him the top scorer in qualifying with six goals.

But the Portuguese missed a half-dozen chances to extend their lead in a game that once again exposed their shortcomings in attack. Postiga and Hugo Almeida both hit the woodwork.