JULY 15: Mr Rajapaksa quit after fleeing to Singapore amid mass protests over his mismanagement of the economy.
Sri Lanka is in the grip of economic chaos as it faces an acute shortage of food, fuel and other basic supplies.
Mr Rajapaksa's resignation paves the way for the country to begin the process of electing a new president.
Sri Lanka's speaker of parliament, Mahinda Yapa Abeywardena, said on Friday that he accepted Mr Rajapaksa's resignation, which he received late on Thursday.
He has called for parliament to convene on Saturday to start the process of electing a new leader.
PM Ranil Wickremesinghe, who was appointed as acting president by Mr Rajapaksa before he fled, will be sworn in as interim president later on Friday.
Parliament has up to a month to elect a new leader, who could be Mr Wickremesinghe.
Mr Rajapaksa fled to Singapore on Thursday from the Maldives, as huge protests roiled Sri Lanka. He is believed to have wanted to leave Sri Lanka before stepping down in order to avoid the possibility of arrest under a new administration.
The embattled leader arrived in Singapore earlier on Thursday after first flying to the Maldives on Tuesday night. Reports say he is accompanied by his wife and two bodyguards.
Singapore's foreign ministry said Mr Rajapaksa had not asked for asylum or been granted asylum. "Singapore generally does not grant requests for asylum," it added.
Jubilation in the streets
In the capital Colombo on Thursday, delighted demonstrators greeted news of the president's departure with dancing.
"We are beyond happy, but also beyond relieved so we can take a break and go back to our lives," Viraga Perera told the BBC.
But the crowds appeared smaller than before after Mr Wickremesinghe imposed a fresh round of curfews on Thursday to quell protests.
The streets of Colombo were calmer as anti-government demonstrators began leaving some of the official buildings they had occupied.
"We are peacefully withdrawing from the presidential palace, the presidential secretariat and the prime minister's office with immediate effect, but will continue our struggle," said a spokeswoman for the protesters.
One person died and 84 others were injured during Wednesday's protests, which took place at key landmarks around the capital, Colombo, including the prime minister's office.
Protesters broke into the presidential palace on Saturday and set fire to the prime minister's private home.
Police fired tear gas at protesters attempting to break down the gates of the prime minister's office in Colombo, before finally forcing their way in. They later headed for parliament but did not get in.
Wednesday saw some of the biggest demonstrations since the protests first began in April.
A resignation that took days to come
The resignation letter Sri Lankans have been waiting for since people power toppled Gotabaya Rajapaksa has finally arrived.
The letter does several things. Firstly, Prime Minister Ranil Wickremesinghe's position as acting president is legitimised. Under Sri Lanka's constitution the prime minister becomes caretaker leader in the event of the president resigning.
Secondly, it clears obstacles blocking the holding of an election in parliament for a new president. MPs had been due to meet on 15 July and start this process, with a vote promised a week later. That was delayed by the lack of a resignation letter but now it has arrived the Speaker will be able to reconvene parliament.
The two main candidates so far are likely to be Mr Wickremesinghe and opposition leader Sajith Premadasa. But given the governing party has a majority, its MPs are likely to back Mr Wickremesinghe - who has close links with the Rajapaksas. Whether Sri Lanka's public would accept this is another matter. The prime minister's resignation, along with that of Mr Rajapaksa, has been a key demand of protesters.
Thirdly, the resignation means Gotabaya Rajapaksa no longer has legal immunity as a head of state and his position is now more precarious as he tries to find a safe country to shelter in.
By Thursday, protesters had handed back the president's official residence to the authorities when the BBC visited. There were no protesters at parliament on Thursday afternoon, a BBC correspondent confirmed.
"We captured this building to show people power. We give it back the way we captured it and leave. We will come back in the next minute if needed," Danish Ali, a protester at the prime minister's office, told BBC Tamil.
With inputs from BBC