Returning striker Leigh Griffiths came to the rescue for Celtic with a dramatic last-minute goal to help his side to a 2-0 win against St Johnstone at McDiarmid Park.
With the Hoops lacking impetus, boss Neil Lennon brought on five second-half substitutes, one of which was Griffiths who has been out since March, and just when it looked like Saints would take a point, the Scotland striker headed in a cross from Hatem Abd Elhamed.
Fellow substitute Patryk Klimala then added a second in stoppage time.
Lennon's side were not at their best but showed grit to extend their winning run to eight games and move top of the Premiership by two points, with Rangers hosting Ross County later in the day.
This was expected to be a straightforward afternoon for Celtic, who had midfielder David Turnbull making his first start since signing from Motherwell and midfielder Olivier Ntcham and defender Elhamed back in the side.
Captain Scott Brown started on the bench along with Ryan Christie, while Nir Bitton was injured.
Defender Liam Gordon and midfielder David Wotherspoon came back into a Saints side which started the game enthusiastically.
Celtic, nevertheless, forced several corners – Gordon may have been tugging the shirt of Celtic defender Shane Duffy in the box at one of them – but the home side held firm.
With their work-rate and organisation, St Johnstone were stifling Celtic's creativity but they were dropping deeper as the visitors dominated the ball.
In the 25th minute, moments after St Johnstone goalkeeper Zander Clark held a Duffy header from a Turnbull corner, Wotherspoon beat Celtic keeper Vasilis Barkas to a Craig Conway cross but the ball spun high in the air and the visitors got it to safety.
Midfielder Callum McGregor's shot from a Greg Taylor cutback slipped past the far post and Odsonne Edouard's shot on the turn trundled into the arms of Clark before Wotherspoon tried an audacious chip from 40 yards which cleared the crossbar.
Saints had a good spell of pressure at the start of the second half.
Conway was presented with a great chance from Wotherspoon's cross from the left but with time and space he thundered his shot against a post and the Hoops goal survived.
Celtic forced a series of corners by way of response as the pressure mounted, but still St Johnstone refused to wilt.
Christie and Klimala replaced Turnbull and Edouard just before the hour and the Polish striker came close with a guided shot from Ntcham's cross from the right – the ball going inches past the far post.
Celtic sensed dropped points but were struggling to find a bit of magic.
Griffiths and Tom Rogic, who had also not played since March, came on to replace Mohamed Elyounoussi and Ntcham and then Brown replaced Taylor shortly afterwards.
Duffy headed another corner over the bar as Celtic ramped up the pressure and then, in the final moments of normal time, Griffiths leapt to bullet in a header from an Elhamed cross.
The goal stunned St Johnstone, who were still shell-shocked as Klimala burst through and drove a second past Clark in time added on.