If Rory McIlroy’s best is as good as it gets, his worst is just about as ugly as it comes. On Thursday, the fans at Royal Birkdale saw a bit of both. On a hot day, with just enough breeze to ruffle the gorse, McIlroy’s game ran stone cold for nine holes. Wayward off the tee, uncertain around the greens, by the time he got off the 6th he was five over par, 10 shots off Jordan Spieth’s lead, and his chances of winning the Open looked dead already.

Only, McIlroy kept at it, forcing the pieces of his game together like a kid puzzling out a jigsaw. He ground around the turn and then picked up four birdies in eight holes. That left him one over, six shots back. He had played his way into trouble and out of it again.

McIlroy has spoken before about his bad habit of blowing majors by throwing in two hours of bad golf. The topic often comes up at Augusta, since he has shot 40 or more over a nine-hole stretch in five of his past six Masters. Here, he covered the front nine in 39. It was not that he fell apart, more that he did not have it together to begin with. His game was off from the 1st onwards, where he skittered a chip off the green, clunked it back up to the fringe and then made a 15ft putt for his bogey, the first, if not the worst, of five in six holes. It was a sorry stretch of golf, as bad as he has played in a major in a long while.

At the 3rd, McIlroy took three putts after his first, over and around a mean little hillock, fetched up well short of the hole. At the 4th he had to splash out of a bunker and then missed a 10ft putt on the left. The 5th was another three-putt, the second of them a particularly egregious miss. And then, after zig-zagging his way around the 6th fairway, his par putt caught the back lip and rolled right back out again.

“I was thinking, geez, here we go,” McIlroy said. “Those thoughts ran through my mind.” By this point the crowd were not cheering him on so much as trying to offer him consolation.

So was McIIroy’s caddie, JP Fitzgerald. At the 6th Fitzgerald said: “You’re Rory McIlroy, what the fuck are you doing?” He was not the only one wondering. “Wake up Rory!” bellowed a fan over the desultory applause as McIlroy walked by. After the round, McIlroy said Fitzgerald’s question helped him snap back to life. “At that point I mumbled and said: ‘Whatever.’ But it did, it helped. It definitely helped. It kept me positive. He just sort of reminded me who I was and what I was capable of. And gave me a few positive thoughts.”

The problem, McIlroy said, was all mental. He was suffering from a combination of a lot of nerves and a lack of confidence. The round was shaping up to be the nadir of a rough year. “Transitional” is the phrase McIlroy has used. He has spent it tinkering with his clubs, trying to find a set he is happy with now that Nike has quit the manufacturing business, and struggling with a persistent rib injury, which flared up again just last month.

He has missed the cut in three of his past four events – the US Open, Irish Open and Scottish Open. His poor form, he said, had “got in my head” and left him with “just not as much belief in myself as I should have had”. But, with a little help from Fitzgerald, it started to come back to him.

McIlroy made a good up-and-down par at the 7th. Then at the 8th a switch flicked. It happened when McIlroy hit his tee shot left into the gallery. The ball fetched up in the worst spot he found himself in all day, over the edge of a footpath, buried so deep the marshals were sure someone must have trodden on it. No such luck. McIlroy had to hack out into the rough but then made a 20ft putt to scramble par. “It was big,” he said. “There’s a big difference between five over par and six over.” He made his first birdie putt from six feet after a fine approach at the 11th and would have clawed back a couple more strokes at the 12th and 13th if a couple of putts had not slid just by.

By the time he came into the stretch, he had his mojo running. He made birdies at the 15th and 17th, and another at the 18th. That last got the loudest cheer of the day. The crowd here still think he can win. So does he. “I actually feel really positive,” he said. “With the way I finished, I feel really good about it. It’s a bit like the Ryder Cup at Medinah in 2012. We’re 10-6 down on Saturday night but we feel like we were right in with a chance, because we won the last two points.”

While McIlroy swayed this way and that, Johnson played steady. He finished one over too, with a solitary birdie at the 2nd and a couple of bogeys at the 7th and 14th. Their playing partner Charl Schwartzel outshone them both and finished in 66, four shots under and one shot off the lead.