Darryll Holland brought 12-1 shot Continent through with a perfectly-timed run on the far rail to land the spoils by half-a-length.
Stablemate Bahamian Pirate (16-1) finished strongly in second, ridden by Richard Hughes.
The 5-2 favourite Danehurst could only manage third place one and a half lengths further back, with Aidan O'Brien's Landseer fourth.
Winning jockey Holland said he had found a recipe for success on Continent.
"We've found the key to riding him and it's nice to pick up a Group One."
Nicholls, meanwhile, expressed his delight after his stable's double netted a hefty share of the £220,000 prize.
"It's amazing. It's a credit to the horses - they made it look easy. I just have the pleasure of training them.
"Darryll's come right on the big day and to be fair to him he's a good jockey. He'll always have the ride on him it's his horse."
In 20 of the last 25 years, the winner of the six-furlong July Cup has gone on to be crowned champion European sprinter.
Last year, it was won by Mozart, trained by Aidan O'Brien, who was responsible for the 1999 winner Stravinsky.
In between came Agnes World, who became the first Japanese-trained winner in Britain.
Darley July Cup result:
1 Continent D Holland 12-1
2 Bahamian Pirate R Hughes 16-1
3 Danehurst G Duffield 5-2 Fav
4 Landseer M Kinane 7-2