By Agence France-Presse
Sirisena's office announced the surprise decision moments after he sacked incumbent premier Ranil Wickremesinghe, despite opponents saying he had no power to do so under the constitution.
Wickremesinghe insisted he was still the legitimate prime minister and would fight his dismissal in court.
"I am addressing you as the prime minister of Sri Lanka," Wickremesinghe told reporters at a nationally televised press conference. "I remain as prime minister and I will function as the prime minister."
The president's United People's Freedom Alliance party had earlier Friday quit the coalition that had governed with Wickremesinghe's party.
Speaking to jubilant supporters outside his Colombo home, Rajapakse called on Wickremesinghe to step down.
Members of Wickremesinghe's party must "respect democracy, respect the country and respect the law", the ex-president said through a loudhailer from a balcony.
Rajapakse loyalists stormed two state-owned television networks overnight -- which they regard as loyal to the outgoing government -- and forced them off the air.
Video footage from private networks showed police overwhelmed by mobs at the Rupavahini national TV station but elsewhere in the capital streets remained calm.
Rajapakse was sworn in by Sirisena in a ceremony at the president's office before the smiling ex-president headed to worship at a Buddhist temple.
A defiant Wickremesinghe, whose United National Party commands a majority in parliament, said he was calling on speaker Karu Jayasuriya to convene the legislature.
The speaker said he was seeking legal advice and would announce Saturday if he recognises Rajapakse as the new prime minister.
Sirisena won elections against Rajapakse in 2015 on a platform of economic reform and accountability for atrocities committed during his opponent's 10-year iron-fisted rule which saw the bloody end of Sri Lanka's brutal civil war.
Colombo was on the verge of facing economic sanctions from Western nations over Rajapakse's human rights record before his government lost office.
Sirisena's decision to appoint his former foe prime minister threatens the Indian Ocean island nation with fresh turmoil just as it was trying to emerge from the shadow of the civil war.
The legality of the move is disputed after a constitutional amendment passed in 2015 removed the president's power to sack the prime minister.
"The appointment of Rajapakse as the prime minister is unconstitutional and illegal. This is an anti democratic coup," finance minister Mangala Samaraweera wrote on Twitter shortly after the appointment was announced.
The dramatic developments came after deepening disagreements between Sirisena and Wickremesinghe over economic policy and day-to-day administration of the government.
- Simmering power struggle -
In May, Sirisena asked his prime minister to end their power struggle and said the coalition should commit to a reform agenda to revive the country emerging from a decades-long ethnic war that claimed more than 100,000 lives.
But Sirisena has reneged on a pledge not to run for re-election, sparking tensions with Wickremesinghe who is believed to have his own presidential ambitions.
Sirisena is also believed to have been behind a failed attempt to impeach Wickremesinghe in April.
Rajapakse lost the presidency in January 2015 and the subsequent parliamentary elections in August 2015.
However, his new Sri Lanka Podujana Peramuna (SLPP) party won local council elections in February and he had been attempting to engineer a dramatic comeback ahead of presidential elections slated for 2019.
The strongman put down the decades-old Tamil Tiger separatist struggle in May 2009 through a military assault that killed up to 40,000 ethnic Tamil civilians, according to rights groups.
His regime refused to acknowledge war-era abuses, and bitter divisions between minority Tamils and majority Sinhalese persist.
The legacy of the conflict has proved a divisive topic in parliament.
Earlier this month, lawmakers passed legislation to pay compensation to victims of the civil war, but Rajapakse's supporters voted against the bill, arguing that it amounted to compensating separatist Tamil rebels.
Rajapakse's hardline government was also accused of corruption and murdering political opponents. Several of Rajapakse's close family and associates face corruption prosecutions.
Sirisena had pledged accountability for war atrocities, but has faced international criticism for being slow to deliver on justice.
International rights groups have called for the prosecution of both the military and the Tigers, who were notorious for suicide bombings and enlisting child soldiers.