KAUNAS, Lithuania (AP) — Bosnia-Herzegovina qualified for its first World Cup after Vedad Ibisevic scored in the second half to secure a 1-0 win over Lithuania Tuesday and top spot in Group G, pushing Greece into the playoffs.

Some of the players and coaching staff were in tears as they hugged each other on the pitch at Darius and Girenas Stadium after the Bosnians held on to the ball for three minutes of injury time.

"What an excellent night," Bosnia coach Safet Susic said. "The players believed they could do it, I believed in them, and we made it."

The winning goal came in the 68th minute when Edin Dzeko ran through the Lithuanian defense to find Ibisevic unmarked for the winner.

The visitors had been thwarted until then by Lithuania's heavily manned defense. Free kick specialist Miralem Pjanic was denied three times by Lithuanian goalkeeper Giederius Arlauskas, as the Bosnians dominated but appeared to lose their nerve for spells of the match, with Greece having taken an early lead in its game.

Ibisevic finally broke the deadlock to the delight of some 10,000 traveling Bosnian fans, who maintained a noisy presence throughout the game. After the match, fans held up flares and unfurled a giant yellow and blue Bosnian flag.

"This team gets better with every game, and the players put everything they had into this match tonight," Susic said.

"The game against Lithuania was even tougher than we had expected. It would have been a shame if we had failed to go straight through. We scored 30 goals in qualification, while the Greeks only got 12. So in the end it worked out."

Bosnia narrowly missed out on the 2010 World Cup and 2012 European Championship, both times losing to Portugal in the playoffs.

In Piraeus, Greece beat Liechtenstein 2-0 but fans at Karaiskakis Stadium were ultimately let down as the new of the late Bosnian goal came through. Dimitris Salpingidis scored in the seventh minute off a slick one-two from Georgios Samaras and Jose Holebas who fired the ball across the goal to find the Greek striker. Giorgos Karagounis added the second in the 81st with a free kick.

"Bosnia is a worthy team. They fought hard and they made it. I congratulate them," Greece coach Fernando Santos said.

"We'd always hoped for direct qualification. We've been racing the Bosnians and in the end it was them who got it. We are disappointed tonight, but that'll be behind us tomorrow."

Bosnia and Greece both finished the group qualification matches with 25 points from 10 matches — eight wins, one loss and a draw.

In the group's other match Tuesday, Renars Rode scored an injury time equalizer for hosts Latvia to end the match 2-2 against Slovakia.

Martin Jakubko and Kornel Salata put the visitors ahead with two goals in the first 16 minutes, while Valerijs Sabala got one back for Latvia two minutes after the break.