Sainz took his first F1 career win as Hamilton made the podium
The Spaniard benefited from questionable strategy calls from Ferrari, which cost his team-mate Charles Leclerc the win and a chance to revive his title hopes.
Lewis Hamilton was in the battle for victory but finished third behind Red Bull's Sergio Perez after a frantic final nine laps following a late safety car.
Leclerc could finish only fourth and Ferrari missed the opportunity to make up significant ground in the title race on a bad day for championship leader Max Verstappen.
The Red Bull driver finished only seventh, his car slowed by floor damage caused by running over debris, but lost only six points to Leclerc as a result of Ferrari's race management.
Verstappen leads Perez in the championship by 34 points, with Leclerc a further nine adrift.
The race was delayed for an hour after a huge pile-up at the first corner caused a red flag, which took attention away from environmental protesters who had invaded the track after the start.
Alfa Romeo's Zhou Guanyu vaulted the barriers at the first corner after sliding upside down across the gravel trap, but was freed from the car by paramedics and declared uninjured after a check-up at the medical centre.
Williams driver Alex Albon was flown to Coventry Hospital for precautionary checks after he was involved in a separate accident, Aston Martin's Sebastian Vettel punting him into the pit wall.
Zhou's accident was triggered when Mercedes' George Russell and Pierre Gasly's Alpha Tauri touched, spinning Russell into the side of Zhou.
The result was defined by a late safety car, as Leclerc was leading and pulling away from Sainz, who was coming under pressure from a charging Hamilton.
Ferrari chose to leave Leclerc out on his used hard tyres, while they pitted Sainz for new softs, a choice made by most other teams with drivers in the leading positions.
That included Mercedes for Hamilton and Red Bull for Perez, who had fought back up into contention after a stop on lap for a new front wing, damaged in a collision with Leclerc on on lap one, and benefited from a free stop under the safety car to get back into contention with the leaders.
When Leclerc was told of the decisions, he said: "That will be hard." And he was right.
Sainz refused Ferrari's request to give Leclerc as much space as possible at the restart and took the lead down the Wellington Straight and into Brooklands corner with nine laps to go.
Behind them, Perez passed Hamilton for third at Turn Four and the two of them closed on Leclerc.
There followed a few laps of quite brilliant racing.
Leclerc sat it out around the outside of Perez at Stowe as he defended his position with six laps to go, and tried to hold on into the slow Vale corner that followed.
Perez cut the apex of the second part of the chicane, a move that was looked at by the stewards before being cleared, and then forced Leclerc wide around Club.
This gave Hamilton the chance to nip inside both of them into second place, but Perez re-passed him into Turn Three on the following lap, and Leclerc also managed to get back ahead of the Mercedes at Turn Four.
Two laps later, Hamilton passed Leclerc around the outside of the long Luffield hairpin.
But Leclerc would not give way and he repassed Hamilton around the outside of the 180mph-plus Copse corner, despite his worn tyres, before Hamilton finally gained the place for good into Stowe with three corners of the lap to go.
Earlier in the race, there had been more questionable decisions from Ferrari.
Sainz had lost the lead to Verstappen at the first start, only for the race to be suspended following the huge crash involving Zhou.
He held on in front of Verstappen with some robust defence at the second start, but the Red Bull tracked him closely and began to pile on the pressure.
When Sainz made a mistake and ran off the track at Becketts on lap 10, Verstappen took the lead but he was into the pits two laps later complaining of a puncture. This soon turned out to be actually the bodywork damage which hampered him for the rest of the race.
Sainz now found himself under pressure from Leclerc, who told the team he was being held up.
Ferrari decided against organising a swap that stage, even though Hamilton was beginning to close on both and looking like a threat for the win and Leclerc was telling them they were destroying his race.
Eventually, Sainz was called into the pits for his stop and Leclerc left out to run longer, but still Hamilton closed in.
When Leclerc pitted, Hamilton stayed out, Mercedes trying to build a tyre off-set so he could attack later.
Leclerc emerged behind Sainz and again put his team-mate under pressure, quicker despite front wing damage incurred in a battle with Perez on the first lap.
Again Leclerc said he was quicker and was told they were racing, but eventually Ferrari ordered Sainz to speed up to a pace he could not reach, and they finally inverted the cars on lap 30, Leclerc proceeding to set a series of fastest laps as he pulled away in the lead.
Hamilton had not pitted at that stage, and finally came in for fresh tyres on lap 33, aiming to charge back at Sainz only for Esteban Ocon's Alpine to grind to a halt on the pit straight and bring out the safety car.
After the race, Ferrari team boss Mattia Binotto took Leclerc aside in the pit lane, and appeared to be telling him to be careful what he said about the way the team had run the race.
But Leclec said that was not the case: "It was more Mattia that tried to cheer me up because I was very disappointed".
The intense fight between him, Perez and Hamilton brought Alpine's Fernando Alonso and McLaren's Lando Norris into the question but Leclerc managed to hold off the veteran Spaniard, who took fifth ahead of Norris.
Verstappen used the fresh soft tyres he was given in the safety-car period to take seventh, holding off the Haas of Mick Schumacher, who scored his first F1 points in eighth place, a year and a half into his career.
Vettel and the second Haas of Kevin Magnussen completed the points positions.
-- Courtesy of BBC Sport