Amazon has confirmed it will acquire iconic film studio MGM in a deal worth $8.45bn (£6bn).

MGM has more than a century of filmmaking history and is the home of a string of famous titles, including Tom & Jerry, The Wizard of Oz and the James Bond franchise.

Read more: AT&T and Discovery to create $150bn media empire to take on Netflix in streaming wars

In a statement today the companies said the merger would complement the work of Amazon Studios, which has largely focused on producing TV shows.

Amazon said it would help to preserve MGM’s heritage and catalogue of films while bringing them to a wider audience through its Prime streaming service.

The deal is the ecommerce giant’s second largest acquisition behind its $13.7bn takeover of Whole Foods in 2017.

“The real financial value behind this deal is the treasure trove of IP in the deep catalog that we plan to reimagine and develop together with MGM’s talented team,” said Mike Hopkins, senior vice president of Prime Video and Amazon Studios.

“It’s very exciting and provides so many opportunities for high-quality storytelling.”

The deal marks Amazon’s efforts to beef up its portfolio of films and TV shows as it takes on rivals such as Netflix and Disney in the rapidly escalating streaming wars.

It comes just a week after AT&T agreed to sell its Warner Media division, which includes CNN and HBO, with Discovery.

The tie-up is set to create a major new player in the streaming market, with a content slate ranging from kids and lifestyle TV to high-end scripted drama.

Read more: Stage and stream: Amazon inks broadcast deal for National Theatre productions

MGM – short for Metro-Goldwyn-Mayer – was founded in 1924 following a merger between the film studios of Marcus Loew and Louis B Mayer.

It boasts a catalogue of more than 4,000 films, including 12 Angry Men, The Pink Panther and Silence of the Lambs. It also owns 17,000 TV shows, such as Fargo and The Handmaid’s Tale.

Read more: Stream team: How Discovery and Warner Media plan to take on Netflix