MOSCOW—Saudi Arabia has signed a commitment to invest up to $10 billion in Russia, the Russian Direct Investment Fund said Monday.

Russia’s latest pact with its closest oil-producing rival marks Moscow’s efforts to replace Western funding, which has been hit by sanctions, just a few days before a summit of five major emerging economies, known by the acronym of Brics, to be held in Russia’s town of Ufa.

The...