"I am resigning, but I am not giving up," Evika Silina, who has been prime minister since 2023, said in a televised statement on Thursday.
Silina's centre-right government will stay on as caretaker until a replacement is sworn in.
Latvian President Edgars Rinkevics, who is tasked by the constitution to select a leader of the government, will meet all parliamentary parties on Friday.
Silina fired defence minister Andris Spruds after two stray Ukrainian drones flew into Latvia from Russia and exploded at an oil storage facility, the latest in a string of such incidents in NATO members Latvia, Estonia and Lithuania.
The drones were not detected by the Latvian army as they flew in from Russia, the army's head said, and Silina blamed Spruds for not having developed anti-drone systems fast enough.
In response, Spruds' Progressives party withdrew its support from Silina's government on Wednesday, leaving her without a majority in parliament and vulnerable to a potential no-confidence motion.
Silina came to power at the head of a broad coalition after the resignation of Krisjanis Karins, also from her centre-right New Unity party, in 2023.
Ukrainian President Volodymyr Zelenskiy said on Wednesday that Ukraine would send experts to Latvia to help protect the country's skies.