The Norwegian star made a jerk halfway through the race and it looked like no one could compete with him.
But on the last hill, Terentev ran past the Norwegian at a furious pace.
The 22-year-old talent then did not let go of the command and crossed the finish line as a winner.
Kläbo had to settle for a second place, while compatriot Erik Valnes came third.
CLIP: Halfvarsson flopped in the sprint: "Felt like it went fast"
Javascript is disabled
Javascript must be turned on to play video
Read more about browser support
The browser is not supported
SVT does not support playback in your browser.
We therefore recommend that you switch to a different browser.
Read more about browser support
Halfvarsson eliminated in the qualifiers Photo: Bildbyrån