The deal of up to €4.68bn creates a joint venture that will allow VW and the US-based electric vehicle (EV) maker to share technology.
Under the agreement, VW said it will initially invest €0.94 billion in the electric truck and SUV maker, with another €3.74bn to be put into the company by 2026.
Founded in 2009, Rivian has not yet posted a quarterly profit. In the first three months of 2024 the company saw a net loss of more than $1.4bn (€1.31bn).
It comes as the electric car sector faces challenges from weakening demand and a trade war which has seen the European Union say it will impose tariffs on Chinese vehicles which have been rapidly expanding globally.
A months-long investigation by the European Commission found that Chinese EV companies had been “unfairly subsidised”.
Officials from China and the EU have held talks ahead of a 4 July deadline in an effort to resolve the deadlock.
The German automotive industry has been opposed to the EU plan amid fears China could impose counter-tariffs to hurt manufacturers such as BMW and Daimler.
Rivian shares jumped by almost 50% after the announcement.
The partnership will give VW immediate access to Rivian’s software and allow the German car maker to use it in its vehicles.
In a separate development, Tesla has announced that it is to recall most of its Cybertrucks sold in the US over issues with their windscreen wipers and exterior trim.
The recalls cover more than 11,000 of the vehicles, which first went on sale at the end of November last year.