Deal undercuts a rival natural gas project backed by the US and European Union.
However, Vladimir Putin, Russia’s president, praised the deal and Serbia’s decision to join the gas pipeline project known South Stream.
Speaking on Friday, he said: “Serbia is becoming one of the key transit links in the formation of a system… that is long-term, reliable, highly effective and significantly strengthens the energy security of Serbia and the whole European continent.”
The pipeline is central to the Kremlin’s efforts to cement its grip on Europe’s gas market and is to be built in tandem with another new pipeline project under the Baltic Sea to northern Europe.
Friday’s accord also foresees building a gas reservoir in Serbia.
On its website, the Serbian government said Gazprom was paying $588m for the stake in NIS and would invest at least $734m in NIS in the next four years.
The energy deal came just 24 hours after Hashim Thaci, Kosovo’s prime minister, said Kosovo would unilaterally announce independence within days.
As the leaders oversaw the signing of the energy deal, Putin told Tadic that he “categorically” opposed a unilateral declaration of independence by Kosovo.
He said: “This would risk provoking serious damage to the whole of the international legal system and would have negative consequences both for the Balkans and the world.”
Tadic, who faces a presidential election run-off on February 3 against hardline nationalist Tomislav Nikolic, thanked Putin for his support over Kosovo.
He said: “Serbia will never renounce the preservation of its territorial integrity. Serbia is always ready for compromise.”
In a statement on Thursday the Kremlin had said it saw no “reasonable alternative” to a negotiated resolution with a leading role played by the United Nations, a reminder of Russia’s ability to veto any UN recognition of Kosovan independence at the Security Council.