The deal, which ends years of speculation about the ownership of the company, will see Bernie Ecclestone remain as chief executive but Chase Carey, vice-chairman of 21st Century Fox, will become the new chairman.
The initial process will see Liberty acquire an 18.7% stake in Formula One from a consortium of sellers led by CVC Capital Partners, the controlling owners of the series, for $746m in cash. The company will then acquire 100% of the shares held by Delta Topco, the parent company and ultimate owner of Formula One.
The total transaction values the firm at $8bn but includes $4.1bn worth of F1's debt.
Liberty Media is buying the stake from the private equity firm CVC Capital, who has held a stake for the past decade but sold some of its holding in 2012.
Greg Maffei, chief executive of Liberty Media, said in a statement: "We are excited to become part of Formula 1.
"We think our long-term perspective and expertise with media and sports assets will allow us to be good stewards of Formula 1 and benefit fans, teams and our shareholders."
Ecclestone, who has run the sport for 40 years, added: "I would like to welcome Liberty Media and Chase Carey to Formula 1 and I look forward to working with them."
Liberty Media, owned by the billionaire John Malone, already has stakes in several sports and entertainment businesses, including the Atlanta Braves Major League Baseball club.