Coroebus prevailed in a thrilling battle to the line to win the St James's Palace Stakes under William Buick and add a Royal Ascot win to his Two Thousand Guineas (G1) triumph.