In a dramatic end to one of the most complex and convoluted takeover sagas in recent memory, Comcast won out in a day-long auction overseen by Britain's Takeover Panel on Saturday.
Comcast's bid was £17.28 per share, beating 21st Century Fox's £15.67 per share, after the auction went to the maximum three rounds.
Brian Roberts, chairman and chief executive of Comcast, said: "This is a great day for Comcast.
"Sky is a wonderful company with a great platform, tremendous brand and accomplished management team.
"This acquisition will allow us to quickly, efficiently and meaningfully increase our customer base and expand internationally.
"We couldn't be more excited by the opportunities in front of us. We now encourage Sky shareholders to accept our offer, which we look forward to completing before the end of October 2018."
Sky's independent directors have recommend Comcast's bid to shareholders, urging them to accept the offer immediately.
It effectively means Rupert Murdoch has failed for a second time to gain full control of the pay-TV giant.
US firm Comcast had originally tabled a £26 billion, £14.75 a share bid for Sky, while Fox's offer for the 61 per cent of the UK broadcaster it does not already own valued it at £24.5 billion at £14 a share.
But Comcast's final winning bid on Saturday - which gives Sky an enterprise value of over £30 billion - dwarfed Fox's.
Fox and Comcast were only allowed to make fixed-price cash bids in sterling.
Comcast owns NBC Universal and is the largest cable operator in the US.
With the Sky takeover, Comcast will become the biggest pay TV provider in the world, with around 52 million customers after adding Sky's 23 million subscribers.
Winning Sky will also aid Comcast in its fight against the rise of Netflix and Amazon.
Ben Barringer, equity analyst at Quilter Cheviot, said: "We can see why Comcast is attracted to Sky. The predominantly US business is in decline - Sky offers it the opportunity to diversify outside of America. The acquisition means that it can expand its customer base in the UK, Italy and Germany.
"Furthermore, Comcast's current viewership is in decline. Consumers are no longer buying whole cable packages but are rather going for 'skinny bundles' with SVODs (subscription video on demand) such as Netflix, which offer content at a lower price point; acquiring Sky means that Comcast can also diversify its route to market."
It is rare for the Panel to run auctions in takeover situations, with Tata's victory in acquiring UK steelmaker Corus in 2008 one of just a few in the past decade.
But it marked a fitting end to a fascinating takeover, which has taken many twists and turns since Fox first made its original £11.7 billion bid in December 2016.
Mr Murdoch has long wanted to seize full control of Sky, having previously made an ill-fated attempt to buy it out in 2011.
Since Fox made its first bid nearly two years ago, it has agreed to sell a major chunk of its business - including its existing 39 per cent Sky stake - to US entertainment behemoth Walt Disney.
Had Fox won the battle to buy Sky before the Disney deal closes, then Disney would have taken ownership of Sky when it closes its own takeover of the Fox assets.
Fox faced heavy scrutiny from the UK Government and competition watchdogs over its Sky takeover plans, while Comcast's bid was cleared by regulators early in the process.
Additional reporting by Press Association