(CNN) -- Turkey snatched a last-gasp winner to eliminate Euro 2008 co-hosts Switzerland and keep their own quarterfinal hopes alive with a 2-1 victory in rain-drenched Basel on Wednesday night.
Patrick Mueller, left, and Swiss goalkeeper Diego Benaglio battle for the ball with Arda Turan of Turkey.
Arda Turan scored with a deflected effort in the third minute of time added on to set up a Group A finale against the Czech Republic on Sunday to determine who takes the second quarterfinal place behind Portugal.
The Turks came from behind after Hakan Yakin gave the Swiss a 32nd-minute lead, with substitute striker Semih Senturk heading a 57th-minute equalizer through the hands of goalkeeper Diego Benaglio.
The St Jakob Park stadium had been flooded by a deluge early in the match, with the downpour continuing until just before half-time.
The treacherous conditions made defending a nightmare for both teams, and Arda almost put Turkey ahead in the 29th minute with a farcical effort.
With minimal visibility in the heavy rain, Benaglio punched a vicious free-kick by stand-in captain Nihat Kahveci onto the head of the 21-year-old winger -- but the ball bounced to safety off the outside of the post.
However, it was the Swiss who adapted the better and they took the lead through the veteran Yakin.
He was on hand to awkwardly steer home from close range with his weaker right foot after Eren Derdiyok -- who like Yakin is of Turkish origin -- beat the offside trap to collect a long pass from defender Philippe Senderos.
Derdiyok calmly check inside the defense in the penalty area and sent a low cross towards Yakin -- who had to wait anxiously at the far post as the ball was held up in a huge puddle of water.
Yakin had earlier been denied by Turkey goalkeeper Volkan Demirel, who also did well to tip a swerving free-kick by Tranquillo Barnetta around the post.
Yakin also missed an even easier chance than the goal he scored in the 34th minute when he stabbed the ball wide of the post following a superb right-wing cross by Valon Behrami which cut out the defense and goal custodian.
Turkey, sensing a lucky escape, came out after the break with renewed purpose and posed a greater threat as the pitch slowly drained of the excess water.
Semih justified his second-half introduction when he rose highest to meet Nihat's superb inswinging cross from the left flank, and Benaglio could only palm the powerful header into the back of the net.
Tempers flared as both sides went in search of the victory, but there was no repeat of the violent scenes that followed Switzerland's World Cup playoff victory against the Turks in November 2005.
Volkan made another superb save from Yakin, and Turkey held off the Swiss onslaught before Arda cut in from the right and fired a shot from just outside the penalty area which clipped the heels of Patrick Mueller and looped over the helpless Benaglio.
"I did wish for rain to stop. I did pray to God for that," Turkey coach Fatih Terim told reporters. "We couldn't predict mud in the middle of the summer.
"It's not easy to come back from a goal down at the European Championship, considering we hit the woodwork once. But we fought a lot in the second half and we created many opportunities."
He added: "Tonight we reminded everyone a little bit about Turkey. Against the Czech Republic, we will be unforgettable."
Defeat was a bitter blow for Switzerland, whose fellow co-hosts Austria will also be eliminated on Thursday if they lose to Poland in Vienna.
"Of course the disappointment is huge," Switzerland coach Koebi Kuhn said. "But I can't blame it on any player or anyone else. We lost twice unluckily."