Bulwark has switched to the Flat after a spell
Outsider Bulwark won the Chester Cup, the feature race of the three-day festival, in a thrilling finish.
Jim Crowley steered the 33-1 shot, who has switched to the Flat and was wearing a visor for the first time, down the outside to victory.
Mick Channon's Som Tala (10-1), under Frankie Dettori, battled back to claim second on the line from Tilt (8-1), with Double Banded (9-2) fourth.
A stewards' inquiry was held but the result remained unchanged.
"The owners are local, it's amazing," said winning trainer Ian Williams.
"We have had the horse since October and we tried him over hurdles. We treated his wind and castrated him and have had this race in mind since November.
"This was the plan and it's nice to see it come to fruition."
Top-weight Shipmaster was pulled up with a circuit to run.
1. Bulwark (J Crowley) 33-1
2. Som Tala (F Dettori) 10-1
3. Tilt (J Murtagh) (8-1)
4. Double Banded (K McEvoy) 9-2