* Ibrahimovic penalty earns hard-fought win
* Goalkeeping errors help Swedes to victory
* Swedish defence vulnerable again at corners (Adds quotes)
STOCKHOLM, June 5 (Reuters) - Sweden edged Serbia 2-1 in their final Euro 2012 warm-up match thanks to a second-half Zlatan Ibrahimovic penalty but they were helped by some goalkeeping errors from the visitors on Tuesday.
Serbia's substitute keeper Damir gave away the spot kick after coming on at halftime to replace Branimir Aleksic whose fumble at a corner allowed Ola Toivonen to give Sweden the lead before Neven Subotic equalised for the Serbs with a header.
Sweden, who face co-hosts Ukraine in their Group D opener in Kiev on Monday, controlled the early stages and Sebastian Larsson nearly scored in the fifth minute from 35 metres after Aleksic cleared the ball straight to him.
Just as Serbia began to find their feet, however, Sweden took the lead when Aleksic made a hash of a corner and the ball fell to Toivonen who had a simple tap in after 23 minutes.
Sweden's Andreas Isaksson made a fine double save following a Zoran Tosic free kick just outside the area but Serbia levelled from the resulting corner with a fine Subotic header - the third headed goal the Swedes had conceded in two games.
The visitors were the better side for the rest of the first half, forcing Isaksson to make several saves.
The Serbs brought on Damir for the nervy-looking Aleksic at the break but he soon dragged down Toivonen in the area after Rasumus Elm had opened up their defence with a slick pass.
Ibrahimovic, the top scorer in Serie A last season, buried the spot kick in the bottom right corner after 52 minutes.
Sweden controlled the rest of a slow-paced second half and could have extended their lead but for some good saves by Damir.
Ibrahimovic was not happy about Sweden conceding another goal from a corner, however, and hoped the defence were getting errors out of their system before the finals.
"That shouldn't be allowed to happen (conceding from a corner). It's now we can make mistakes and now everything can go wrong - it can't be allowed to happen in six days' time,@ he said.
"It's easier to correct if it happens at a dead ball situation but it shouldn't happen either, not two matches in a row. It's just a case of taking out the video and seeing what went wrong."
After facing Ukraine, Sweden will play England and France in the group stage of Euro 2012. (Writing by Johan Ahlander; Additional reporting by Phil O'Connor in Kiev; Editing by Ken Ferris)