Of the 564 members of the assembly present for the vote, only four voted to keep the monarchy.
The group met all day in a convention center to reach the agreement and even continued to work after the facility was bombed.
Two apparent bombs damaged the building about 8:20 p.m. local time, said a CNN journalist covering the meetings.
There were no reports of injuries, and the group was back working within 10 minutes of the blasts.
Even though the meeting went late into the evening, a small procession of people could be seen celebrating outside the convention center when the news of political transition was announced.
There was no immediate reaction from the palace, which has rarely commented on political developments in Nepal since King Gyanendra was forced to end his royal dictatorship and restore democracy after widespread protests two years ago.
The country's former rebels, the Maoists, then ended their 10-year communist insurgency and in April won the most seats in the assembly, setting the stage for the end of Nepal's monarchy.
Wow. Three years ago I thought of crossing over into Nepal from India, and the Maoists and the King were killing people. Now the Maoists are elected to run the government. Democracy in action.