A last-minute Masahiko Inoha strike gave ten-man Japan a 3-2 victory over Asian Cup hosts Qatar at Al Gharafa Stadium to send the Blue Samurai through to the semi-finals.
Qatar had stunned their opponents in the 12th minute when Sebastian Soria struck but Shinji Kagawa levelled midway through the half with his first of the tournament.
Japan were reduced to ten men in the 63rd minute when Maya Yoshida was shown a second yellow card and substitute Fabio Cesar regained the lead for Qatar from the resulting free-kick.
But despite their numerical disadvantage Japan finished strongly, with Kagawa levelling in the 70th minute and Inoha grabbing the winner with a minute left on the clock.
Alberto Zaccheroni's side were on the back foot from the outset as Mohamed El Sayed stabbed a shot straight at Eiji Kawashima before the keeper was forced into a fine one-handed save from Mesaad Ali moments later.
But the Lierse SK shot-stopper was beaten in the 12th minute when the ever-dangerous Soria beat the offside trap to race down the wing before cutting inside the area and dispatching a low shot into the back of the net.
That goal perhaps shook Japan into life and they went on the attack as Yuto Nagamoto shot just wide midway through the half.
And they hauled themselves level just before the half-hour when Kagawa nodded home Shinji Okazaki's cross from close range.
Qatar keeper Qasem Burhan kept out Makoto Hasebe's 35th-minute drive before Kagawa fired wide as Japan pressed for an equaliser before the break.
They continued to attack after the restart with Okazaki flicking a header just wide and Nagamoto sending a shot straight at Burhan.
But a moment of recklessness swung the game in Qatar's favour in the 63rd minute when Yoshida was sent off for a second bookable offence after illegally impeding Yusef Ahmed and from the resulting free-kick Cesar stepped up to a curl the ball inside Kawashima's near post.
Japan took just seven minutes to respond, however, as Kagawa skipped past the challenge of Ali inside the area before driving a shot beyond Burhan.
Both sides then had chances to score again but it was the Japanese who snatched the winner when Kagawa latched onto a pass just outside the area, broke into the box and though he tumbled under the challenge of Khaled Muftah, Inoha pounced to stroke home and send the East Asians through to the semi-finals.