Quim Torra, a newcomer to politics who has campaigned fiercely for Catalonia's independence, was appointed regional president Monday vowing to keep fighting for a break from Spain.
Torra's election by the regional parliament paves the way for a new government in Catalonia after months of political limbo.
Analysts warn the road ahead will be rocky as Torra faces rifts within the separatist camp and Catalans remain deeply split over leaving Spain.
Torra, handpicked as presidential candidate by deposed, exiled leader Carles Puigdemont, scraped through the parliamentary vote -- 66 separatist lawmakers voted for him, 65 anti-independence MPs against and four abstained.
"We will build a Catalan republic," he said after the vote, as lawmakers sang Catalonia's anthem "Els Segadors" ("The Reapers" in English).
The 55-year-old father of three pledged to respect the result of an independence referendum held on October 1 despite a court ban and marred by police violence.
Catalan separatist authorities said 90 percent of the 2.2 million people who cast their ballot in the referendum -- out of 5.5 million eligible voters -- opted to break from Spain.
- Puigdemont's pick -
Prime Minister Mariano Rajoy called for "understanding and harmony" but warned that he would not tolerate any flouting of the law and Spain's constitution.
The formation of a new government will automatically lift direct rule imposed by Madrid on October 27 after separatist lawmakers made a short-lived unilateral declaration of independence.
In a bid to end the biggest political crisis to hit Spain in decades, Rajoy called snap regional elections, held in December, which separatist parties won as the secessionist movement in Catalonia showed no sign of dying down.
But since then, the presidential candidates put forward by the separatist camp all fell flat as they were either in jail in Spain over their role in the secession bid or in self-exile.
Torra, who was elected to the Catalan parliament in December on Puigdemont's Together for Catalonia list, finally made it through as he has no legal woes.
Puigdemont, who was deposed by Madrid last October, was shown on Catalan television watching Torra's speech from Germany where he awaits a court decision on whether to extradite him to Spain.
He faces jail on rebellion charges for last year's secession bid if he returns.
In an interview published Saturday by Italian daily La Stampa, Puigdemont said Torra, as his designated successor, "takes power in provisional conditions and he is aware of that".
For his part Torra, who is heading to Berlin to meet with Puigdemont on Tuesday, said he would stay in the post only until the ousted leader, whom he called the "legitimate president", returns home.
Ines Arrimadas, leader in Catalonia of the centrist, anti-independence Ciudadanos party, has branded Torra a mere "puppet" of Puigdemont.
- Crisis not over -
Torra tried -- and failed -- to be appointed on Saturday at an initial parliamentary vote that required an absolute majority.
During Monday's session, in which he needed only a simple majority, he outlined his new government's plans for education, health and employment.
On Saturday, he had focused entirely on independence.
During that speech, he lambasted European institutions for their "unacceptable silence" over the Catalan crisis.
He also said a "Republican council" would be created abroad in parallel, presided by Puigdemont, as well as an assembly composed of local officials.
Torra has received harsh criticism for some of his past articles and tweets.
He has described Spain as "a country that exports misery" and slammed those who do not defend the Catalan language and culture as "scavengers, vipers and hyenas".
A tweet he posted in 2012 said: "Spaniards only know how to plunder."
He has since apologised.
Antonio Barroso, deputy research director at Teneo Intelligence, said Torra faces divisions within the separatist camp, composed of the small, radical CUP party, the leftwing ERC party and the Together for Catalonia grouping.
The ERC wants a moderate approach to avoid a clampdown by Madrid and to play a longer independence game, he said.
"In contrast, Puigdemont's strategy is to continue using every opportunity... to continue challenging the Spanish authorities and keep the secessionist momentum alive."
For Oriol Bartomeus, politics professor at Barcelona Autonomous University, the region risks having "a divided government -- there could be fallout".
Hardline nationalist Quim Torra is set to take over the regional presidency of breakaway Catalonia, but analysts have warned of trouble ahead
Deposed Catalan leader Carles Puigdemont is in exile in Germany and faces jail on rebellion charges if he returns to Spain
Here is a timeline of the Catalan independence crisis