Joe Klamar, Getty Images
Turkish players celebrate at the end of the Euro 2008 Championships quarterfinal soccer match Friday at Ernst Happel Stadium in Vienna.

VIENNA, Austria — Turkey has perfected the great escape.

The Turks taught the European Championship another lesson in fortitude Friday night to advance to the semifinals with a 3-1 shootout victory over Croatia following a 1-1 draw through injury time. They barely got the goal that forced the penalty kicks that they then dominated.

After a 0-0 draw in regulation, the Croats seemingly won it when Ivan Klasnic put in a header in the 29th minute of extra time. Stunningly, Semih Sunturk, who later scored in the shootout, got the equalizer with seconds remaining, scoring from just inside the area off a free kick taken by goalkeeper Rustu Recber from near midfield.

"There was no time to regret or worry about what had happened," Turkey midfielder Hamit Altintop said. "We would have time to weep after the referee had blown the final whistle, so we had to play without fear."

A minute before, Recber's error allowed Klasnic to score. Recber chased after a ball headed out of bounds, and Luka Modric passed it to Klasnic for a short header.

But the Turks, who rallied with two late goals to beat the Czech Republic and qualify for the quarterfinals, had another dramatic strike in them.

"To lose a lead in such a short space of time would be a blow to any team. I knew they would be feeling it psychologically," Turkey coach Fatih Terim said of the Croats. "I tell my players never to give up. I tell them that they shouldn't be afraid of losing or conceding goals. This is football. You should never give up until the referee blows the final whistle."

After that, it was relatively easy in the penalty-kick shootout. Modric and Ivan Rakitic shot wide, Turkey made its first three tries, and Recber dived left to save a penalty shot from Mladen Petric to clinch it.

Arda Turan, Senturk and Hamit Altintop scored for Turkey in the shootout. Darijo Srna got Croatia's only shootout goal.

Turkey will face Germany in the semifinals on Wednesday in Basel, Switzerland. Neither team won its first-round group.

"I congratulate the guys, ours and the Turks," Croatia coach Slaven Bilic said. "That's why football is the best, the most dramatic sport on earth."

Police and first aid workers said more than a dozen Croatian fans needed medical treatment after Turkish supporters attacked them in the final minutes of the match. The violence erupted in the main fan zone next to Vienna's City Hall. No major injuries were reported.

Klasnic is the first player to appear in Euros after needing a kidney replacement. He had one donated by his father, and returned to play in the Bundesliga before joining the national team.

Until the dying moments, it was a low-quality match marked by defensive caution. The depleted Turkish team restricted Croatia to few opportunities by pressing in midfield and not allowing the Croats time on the ball. And Croatia, which won Group B, showed little of the attacking flair it used to beat Germany in the opening round.

"It seemed like the match was over, then to concede a goal, then go on to penalties, gave a psychological advantage to the Turks," Bilic said. "This certainly isn't going to be easy to forget. Not only will we not forget this, this will haunt me for the rest of my life."

There were a few good chances to score, though. Croatia striker Ivica Olic hit the crossbar in the 19th minute from close range after a low cross from Modric. In the 83rd, Recber, playing for the suspended Volkan Demirel, preserved the shutout when he made a diving one-handed save on a free kick by Srna.

The Turks were missing four injured players and two under suspension. The veteran Recber, who helped Turkey make the World Cup semifinals six years ago, made the absence of Demirel less painful until his extra-time blunder.

Then he made up for it with his free kick and his work in the shootout.

Back home, cars with horns blaring circled the streets of city centers across the nation, with fans leaning out of the windows waving flags and shouting.