Japan earned a place in the knockout stage of the men's Olympic volleyball tournament on Sunday, beating Iran 3-2 in a must-win final pool phase game.

Driven by key performances from Yuji Nishida, Yuki Ishikawa and Ran Takahashi, Japan weathered some testing moments to escape with a 25-21, 20-25, 29-31, 25-22, 15-13 win at Ariake Arena.

Japan beats Iran in a preliminary-round game in the Tokyo Olympic men's volleyball on Aug. 1, 2021, at Ariake Arena. (Kyodo)

Nishida had 30 points, the highest single-game scoring total at the Tokyo Games.

The victory gave the host team a three-win, two-loss record and secures third position in Pool A. The top four teams qualify for the quarterfinals.

Canada came fourth ahead of Iran despite both teams finishing with two wins.

Japan's win was far from easy, though.

After sharing two tight first sets, Japan failed to capitalize on four set-point opportunities in the third. Iran had one, and converted to make it 2-1.

Having gone a set down, Japan responded, playing strongly across the final two stanzas to ensure their Tokyo Games continue.