The move ends years of speculation about the ownership of the company.
Bernie Ecclestone will remain as chief executive but Chase Carey, vice-chairman of 21st Century Fox, will become the new chairman.
Liberty Media has stakes in several sports and entertainment businesses, including the Atlanta Braves Major League Baseball club.
Owned by the billionaire John Malone, Liberty will initially purchase a minority stake in the world's leading motor-racing championship. A full takeover is planned if regulators approve the deal.
The total transaction values the firm at $8bn but includes $4.1bn worth of Formula 1's debt.
This is one of the biggest deals in sports history and one of the most important moments in the history of F1.