Mohamed Elyounoussi scored a 90th-minute winner to dig Celtic out of a hole and clinch an underwhelming 1-0 Europa League qualifying victory at Riga, securing a spot in the play-off round.
Neil Lennon's men were poor for long periods of the match, struggling to make the most of their superiority and undoubtedly greater quality, but substitute Elyounoussi finally found the breakthrough right at the end.
A collection of Riga fans in open-top buses behind one of the goals will not have been enough to intimidate Celtic, but the Scottish champions were significantly lacking invention for much of the game, managing only two shots on target in the first period.
Jeremie Frimpong, brought on for the injured James Forrest in the opening 45 minutes, showed some initiative and was unsurprisingly the one to craft Elyounoussi's goal, which secured a clash with either Sarajevo or Buducnost in the final qualifying round.
It took Celtic – who were eliminated from Champions League qualification by Ferencvaros – 36 minutes to begin offering any kind of attacking threat on top of their control of the ball, with Olivier Ntcham's 30-yard piledriver forcing Roberts Ozols to tip over.
The goalkeeper had a slightly easier save to make soon after, pouncing on Nir Bitton's disappointingly tame effort from the centre of the box.
Celtic endured a slow start to the second period as well but went close with an hour played, Frimpong finding Ryan Christie in the area for a shot at Ozols after skipping past a challenge.
Frimpong was again the chief threat to Riga's defence with a little over 15 minutes to go, but Albian Ajeti – introduced a few moments earlier – met his cross and somehow appeared to block his own shot from point-blank range.
Celtic eventually found the winner late on, Elyounoussi meeting Frimpong's low delivery and guiding it into the bottom-left corner.