Ukraine and Russia have continued attacks on each other's energy infrastructure despite an announcement by US President Donald Trump on Monday that they had agreed to stop.
Moscow Mayor Sergei Sobyanin said on his Telegram channel that the biggest Ukrainian drone attacks had been thwarted, with Russia downing more than 1600 drones since Saturday, including 450 headed for Moscow.
Several drones reached the premises of the oil refinery and one hit an apartment, Sobyanin said.
"The unprecedented attack was clearly planned with the aim of disrupting the elections," he said. "The adversary failed to achieve this."
Reuters witnesses heard blasts in Moscow and saw plumes of smoke billowing from the site of the Moscow refinery. The scale of any damage to the facility was not immediately known.
Ukrainian strikes have knocked out a significant part of Russia's oil refining capacity, triggering oil product shortages, fuel price increases and long queues at filling stations in many regions across the country's 11 time zones.
In the wider Moscow region, in addition to the two deaths, 400 people, including 70 children, were evacuated from a 21-storey apartment block in the Ramenskoye district and a number of homes were damaged, said Governor Andrei Vorobyov.
Earlier on Sunday, authorities said a Russian drone attack killed a mother and her two three-year-old children in Ukraine's Kyiv region when it hit a private home.
Kiev regional military governor Tymur Tkachenko said a girl, a boy and a woman were killed in a Russian strike on the Fastiv district on Saturday evening.
"There are no words to express the pain of this loss," Tkachenko wrote on Telegram.
"This is an irreparable tragedy."
Kyiv and the surrounding region have been repeatedly targeted since Russia's invasion began more than four-and-a-half years ago, with frequent air raid alerts recently.