Japan scored a controversial injury-time try to snatch a draw in their battle with Canada to avoid Pool B's wooden spoon at the Rugby World Cup.
Koji Taira touched down deep into overtime after referee Jonathan Kaplan refused to halt the game with Canada leading 12-5.
Tries from Pat Riordan and Dth van der Merwe had seen the Canucks overturn a half-time deficit inflicted by Kosuke Endo's brilliant solo score.
The result helped Japan avoid their 14th successive defeat in World Cups, and denied Canada the chance to maintain their record of posting a win in every tournament for which they have qualified.
Japan started with great intensity and Canada needed some stout defending to keep them out in the opening minutes.
But just when they were starting to get a foothold in the game, Canada were undone by Endo's superb individual try.
After Japan stole the ball at the lineout, the wing steamrollered his way through the first line of defence before shrugging off another attempted tackle and touching down.
Shotaro Onishi missed the conversion.
Japan spent almost all of the remainder of the half on the back foot as Canada set up camp in their half of the field.
They lacked the power or penetration to break through and with just over five minutes of the half remaining, hooker Pat Riordan was sin-binned for stamping.
With the half-time whistle looming, Canada came agonisingly close to levelling but Japan produced a series of last-gasp tackles on their own tryline.
Canada unusually elected to stay out on the pitch at half-time and the tactic appeared to pay off.
Seven minutes into the second half and their forward power finally told as Riordan returned from his 10-minute expulsion to eventually finish off after a succession of rolling mauls.
James Pritchard failed with the conversion to keep the scores level.
Japan decided to take a leaf out of their opponents' book, using their forwards to inch ever nearer the Canada line.
Even when they won a penalty, they opted to kick to touch to maintain the pressure, but it came to nothing.
It was becoming single-tactic match, with Canada's forwards again attempting the pushover try.
One effort was referred to the television match official but it was rightly denied.
Morgan Williams finally put an end to the monotony by tapping and kicking a penalty crossfield to Van der Merwe for the easiest of touchdowns. Pritchard made no mistake with the conversion.
As Canada did in the first half, Japan piled on the pressure late on but they appeared to have failed to get the try they needed when the ball went for alineout in stoppage-time.
But Kaplan played on and Japan poured forward again, Taira eventually touching down in the corner.
Onishi kicked the conversion from out wide to spark jubilant celebrations among the Japanese players.
Japan (5) 12
Tries: Endo, Taira
Canada (0) 12
Tries: Riordan, Van der Merwe
Canada: Pyke, Van der Merwe, Culpan, Spicer, Pritchard, Smith, Williams, Snow, Riordan, Thiel, Burak, James, Yukes, Kleeberger, Carpenter.
Replacements: M. Pletch, D. Pletch, Franklin, Jackson, Webb, Fairhurst, Mensah-Coker.
Japan: Aruga, Endo, Imamura, Onishi, Loamanu, Robins, Yoshida, Nishiura, Matsubara, Soma, H. Ono, Thompson, Makiri, O'Reilly, Miuchi.
Replacements: Inokuchi, Yamamura, Vatuvei, Kiso, Kim, Taira, Onozawa.
Referee: J Kaplan (South Africa)