Hatoyama's approval ratings had plummeted after he backtracked last week on a pledge to move the US Futenma Marine Air Station off Okinawa.
His decision to keep the unpopular base on the island, despite strong local opposition, caused a split in his three-party coalition, with the small Social Democrat party quitting the government on Sunday.
The prime minister had faced growing pressure from within his own Democratic Party of Japan (DPJ) for him to step down to revive the party's fortunes ahead of an election for the upper house of parliament expected on July 11.
Kingmaker also to step down
With tears in his eyes, Hatoyama told party legislators that he, and Ichiro Ozawa, the party secretary-general seen by many as the real power behind Hatoyama's administration, would both resign.
"In order to revitalise our party, we need to bring back a thoroughly clean Democratic party. I would like to ask your co-operation," Hatoyama said.
|The PM has faced growing party pressure to quit ahead of upper house polls in July [AFP]
A new leader will be chosen in a few days, a party official said, and analysts have tipped Naoto Kan, the finance minister, as the frontrunner to replace Hatoyama.
The Democrats swept to power in August after a landslide election win for parliament's more powerful lower house, ousting the conservative Liberal Democratic party (LDP) after more than 50 years of almost continuous rule.
But doubts over Hatoyama's perceived indecisiveness have eroded the government's approval ratings, with one poll showing support at just 17 per cent.
Some analysts said the change of the party's top two leaders would help restore the Democrats' popularity ahead of the election, although many voters had been outraged when two leaders of previous LDP-led governments quit abruptly after just a year in office.
Katsuhiko Nakamura, the director of research at the Asian Forum Japan, said "although getting rid of Ozawa and Hatoyama won't win back all that support, at least the Democrats will no longer have to be on the defensive during the campaign".
Hidenori Suezawa, the chief strategist at Nikko Cordial Securities, said the move "will put an end to downward trend in the popularity of Democrats", adding that "Ozawa must have made this decision to win the election".
Hatoyama is the fourth Japanese prime minister to resign in four years.
A political funding scandal embroiling Ozawa and some aides, along with Hatoyama's perceived inconsistency and indecision - particularly on the relocation of the US Marine Air Station Futenma on Okinawa - sent his approval rating plunging.
|The US base on Okinawa has been a contentious issue for several years [Reuters]
He had taken office pledging to create a "more equal" relationship with the US and promised to move the marine base off the island, which hosts more than half the 47,000 US troops stationed in Japan under a 50-year-old security agreement.
US military officials argue that it is essential the base remain on Okinawa because its helicopters and air assets support marine infantry units based there. Moving the facility off the island, they say, could slow the marines' co-ordination and response in times of emergency.
Last week Hatoyama said he would go along with a 2006 agreement to move the base to a northern part of Okinawa, infuriating residents who have long complained about noise levels, pollution and crime associated with troops from the base, and want it off the island entirely.
Hatoyama's three-way coalition was cut to two members over the weekend when the Social Democrats withdrew after the prime minister expelled its leader Mizuho Fukushima - who rejected the Futenma decision - from the cabinet.
Fukushima's dismissal enhanced her public standing as a politician who stood up for her convictions and reinforced perceptions of Hatoyama's wishy-washiness.
The DPJ and a remaining coalition partner still hold a majority in both houses of parliament - although just barely in the less powerful upper house.