Frankel retained his unbeaten record but had to work for victory in the St James's Palace Stakes at Royal Ascot.
The brilliant 2,000 Guineas winner looked set for another cosy success before appearing to tie up in the final furlong.
Sent off the 3-10 favourite, the colt burst into an electric lead before 20-1 chance Zoffany closed in the dying strides and Frankel held on by three-quarters of a length, with Excelebration third.
The winner, trained by newly-knighted Sir Henry Cecil and ridden by Tom Queally, is now unbeaten in seven races.
However, the way he appeared to be treading on water in the final stages of the race was unexpected.
Stablemate Rerouted had set off like a hare in the one-mile feature race on the first day of the famous meeting.
Queally decided to let the hot favourite make his move and he surged into a lead as the Ascot crowd roared their approval on a sun-kissed day.
It initially appeared as though the horse, who won the Guineas by six lengths, would secure another comfortable triumph.
But having been out on his own for much of the race, Zoffany and Excelebration were among the challengers to make their move.
Frankel dug deep to land the Group One prize, but it was not the procession many racing fans had forecast.
Queally insisted the three-year-old was not tiring after taking up the running so early, explaining: "He was starting to get a bit fed up of it at the front.
He added: "He's more versatile than people think and he's still the one to beat at the moment."
Sir Henry backed up Queally's claims, saying of the unbeaten colt: "He had the race won and thought he'd done enough."
The trainer admitted it was "inevitable" Frankel would race against Canford Cliffs and Goldikova at some point after the duo fought out a thrilling Queen Anne Stakes in the opening race of the meeting.
Canford Cliffs, an 11-8 shot, powered past last year's winner in the final furlong to win by a length, with Cityscape third.
Cape Blanco set the early pace before Goldikova made her move two furlongs out, but she did not have enough in the tank to hold off Canford Cliffs.
"He is an amazing horse," said winning jockey Richard Hughes.
"I'm sure whatever horse you put in front of him, he'd go by them. He is the best horse I have ever ridden."
Canford Cliffs denied French mare Goldikova, who went off at 5-4, her 14th Group One victory.
A fine late ride by Jim Crowley on Prohibit took the honours in the second race of the day, the King's Stand Stakes.
The Robert Cowell-trained six-year-old, backed from 14s into sevens, was produced from the pack inside the final furlong, holding off another late charge from the favourite Star Witness, with Sweet Sanette third.
The Coventry Stakes saw another thriller, as 4-1 favourite Power enjoyed a ding-dong battle with Roman Soldier before surging ahead as they approached the line, with St Barths third.
Eddie Ahern rode an unscheduled winner on Veiled in the Ascot Stakes - after Kieren Fallon pulled out with a neck problem that required treatment - while Jonny Murtagh nicked the Windsor Castle Stakes on Frederick Engels.