Rivian Automotive Inc. is working with Mercedes-Benz Group AG to establish a new European factory to make both companies’ electric vans.

The two companies said Thursday they signed a memorandum of understanding to establish a joint venture to invest in and operate a factory in Europe to produce large electric vans for both companies, starting in a few years. The planned facility, which would only produce electric vehicles, would use an existing Mercedes site in Central or Eastern Europe, the companies said.

The agreement is subject to Rivian and Mercedes entering into final binding agreements and obtaining the relevant regulatory clearances.

Shares of Rivian rose more than 7% to $35.65 in early trading. The stock is still down by about two-thirds this year.

The companies said they hope to design electric vans that are optimized for efficient production on common assembly lines at the plant, which will produce two large vans, one based on Mercedes’ electric-vehicle platform and the other based on the Rivian Light Van platform.

The companies said the collaboration will help both of them rapidly scale the production of electric vans while benefiting from operations synergies and lowering costs.

The news comes as Rivian enters a period in which it is under pressure to prove it can rapidly increase its production rate and deliver vehicles to tens of thousands of waiting consumers. In the second quarter, Rivian said it produced 4,401 vehicles, a figure it needs to more than double in each of the final two quarters of the year to hit its target of 25,000 for the year.

While factory output is improving, Rivian has said that its assembly lines are designed for building a higher number of vehicles than it had been producing, resulting in labor and overhead costs weighing on its bottom line.

Write to Will Feuer at will.feuer@wsj.com