One of those who died on Tuesday was a baby who suffered breathing problems, while another 30 people have been injured.
Surono, the government's chief volcanologist, said the mountain, which had been rumbling for hours, started to erupt just before dusk, a day after the agency raised the alert status to the highest level.
"We heard three explosions around 06:00 pm (1100GMT) spewing volcanic materials as high as 1.5 km upward and heatclouds down on the slopes," Surono, who like many Indonesians goes by only one name, told the AFP news agency.
Indonesian scientists had warned of a pressure build-up beneath Mount Merapi's lava dome, as authorities evacuated tens of thousands of villagers to temporary shelters.
An avalanche of rocks spilled down Merapi's slopes before dawn on Tuesday and gusts of ash rose 50 metres into the air as the mountain continued to rumble.
Surono had said earlier that the greatest concern was pressure building behind a massive lava dome that has formed near the tip of the crater.
"The energy is building up. ... We hope it will release slowly," he said.
"Otherwise, we're looking at a potentially huge eruption, bigger than anything we've seen in years."
Temporary shelters were set up after officials designated an area 10km around the country's most active volcano a danger zone.
More than 50,000 people living in the shadows of the volcano, located north of the Javanese cultural capital, Jogjakarta, are now facing evacuation.
Widi Sutikno, a field co-ordinator in the Sleman district on the southern slopes of the 2,914-metre mountain, said about 3,700 people had already moved to makeshift camps.
"We have evacuated many women, pregnant women, sick people, elderly people and children," Sutikno said.
"We let some people return to their fields for their daily activity. But they need to go back to the camps and not their houses."
Step Vassen, Al Jazeera's correspondent close to Mount Merapi, said: "There was huge panic of course when the eruption was taking place.
"Two women are in hospital with severe wounds due to the hot gas clouds that came down from the mountain that can reach 600 degrees Celsius, so they are very dangerous.
"Now thousands of people are running away, they are trying to find a safer place. They are going to the refugee centres that have been set up by the government."
Vassen said that as Merapi is the most active volcano in the country residents were reluctant to leave for fear of leaving homes and livestock unattended for a false alarm.
Merapi last erupted in 2006, when it sent an avalanche of pyroclastic ash - hot gases and rock fragments - racing down the mountain which killed two people.
A similar eruption in 1994 killed 60 people, while 1,300 people died in an eruption in 1930.
There are more than 129 active volcanoes in Indonesia, which are spread across 17,500 islands and prone to eruptions and earthquakes due to its location within the so-called Ring of Fire.
The ring comprises a series of fault lines stretching from the western Hemisphere through Japan and Southeast Asia.