|Search ON THIS DAY by date|
All 14 Tupac Amaru rebels were killed, including their leader, Nestor Cerpa Cartolini.
One hostage - supreme court judge Carlos Giusti Acuna - died, as well as two Peruvian soldiers.
The end to the hostage crisis came at 1530 local time (2030 GMT) as about 15 soldiers in ski masks swarmed over the roof of the building.
A series of explosions shortly afterwards left a gaping hole in the roof of the embassy. Several smaller explosions were said to be caused by booby traps left by the rebels.
The assault lasted 40 minutes. As gunfire echoed around the compound, the hostages staggered, crawled or were carried out of the embassy. Several were injured.
They included the Peruvian Foreign Minister, Francisco Tudela, and the Japanese Ambassador, Morihita Aoki.
As the gunfire died away, jubilant soldiers tore the Tupac Amaru rebel flag from the roof of the embassy and the Peruvian President, Alberto Fujimori, joined some of the former hostages in singing the national anthem.
The president has taken sole responsibility for the surprise decision to send in the troops.
It was a massive risk: the Japanese government, one of Peru's main trading partners, had been pressing him for a negotiated settlement to the crisis.
In the end, he went ahead without even letting them know.
The Japanese Prime Minister, Ryutaro Hashimoto, expressed regret at that decision, but also thanked President Fujimori.
"It is not important whether we had prior knowledge of the move. The important thing is that the hostages were freed," he said.
The siege began on 17 December when the Marxist rebels stormed a diplomatic cocktail party, seizing more than 400 guests, most of whom were freed in the next few days.
They are believed to have chosen the Japanese embassy because of Japan's support for President Fujimori, who is of Japanese immigrant parentage.
Mr Fujimori has made his political reputation by taken a strong line against Shining Path and Tupac Amaru rebels in Peru.
He is likely to use the successful outcome of the siege as a vindication of his tough stance on terrorism.
It emerged that security forces - helped by the British SAS - had prepared for the attack up to two weeks in advance.
They dug a network of tunnels under the embassy to install surveillance equipment, pinpointing the whereabouts and movements of both hostages and rebels.
Most of the guerrillas were killed when a tunnel packed with explosives blew up under their feet as they played football.
Alberto Fujimori resigned in November 2000 after a bribery scandal involving his former intelligence chief, Vladimiro Montesinos.
Montesinos himself went into hiding for eight months.
During this time, in March 2001, the bodies of all 14 rebels involved in the Japanese embassy siege were exhumed amid allegations that troops shot some of them after they had surrendered.
The subsequent investigation concluded that at least three of the rebels were executed.
In 2002, Montesinos was charged with ordering his intelligence officers to kill them.
The charges are among 70 outstanding allegations against Montesinos, and he has yet to stand trial for them.
He is already serving a 15-year jail sentence for embezzlement, conspiracy and corruption.
|Search ON THIS DAY by date|