(adds dropped word Ghannouchi in para 9)
By Tarek Amara
TUNIS, Nov 13 (Reuters) - Tunisia's new parliament on Wednesday elected Rached Ghannouchi, leader of the moderate Islamist Ennahda party, as its speaker after the rival Heart of Tunisia party backed him, opening the way for a possible coalition government between them.
Ennahda came first in last month's election, but took only 52 of 217 seats in a deeply fragmented parliament, forcing it to compromise to win majority support for its preferred candidates for speaker and for prime minister.
However, its efforts to build a coalition with several rival parties have so far come to nothing and Tunisia continues with a caretaker government under the existing prime minister, Youssef Chahed.
Wednesday's election for speaker represented a big test for Ennahda, which was banned before Tunisia's 2011 revolution but has since played a big role in several coalition governments.
Its veteran leader Ghannouchi, 78, had faced competition from two rival politicians for the post of speaker. It is his first official post since he returned to Tunisia from exile in London after the 2011 revolution.
It was not immediately clear what price, if any, Heart of Tunisia asked for supporting Ghannouchi as speaker but the party led by media magnate Nabil Karoui now appears likely to join a coalition government with Ennahda.
"The party decided to vote for Ennahda after an agreement," said Ridha Charfeddine, a Heart of Tunisia lawmaker.
It and Ennahda have presented themselves as ideological rivals and have both previously ruled out entering into coalition.
The Attayar and Achaab parties refused to support Ghannouchi in Wednesday's vote.
Ennahda, as the biggest party in parliament, has until Friday to name its nominee for prime minister, starting the clock on a two-month process for that person to form a government. It is not yet known whom it will nominate.
Tunisia's post-revolution constitution splits power between the newly elected President Kais Saied and a government that passes legislation through the parliament. (Reporting By Tarek Amara Editing by Angus McDowall and Gareth Jones)
Our Standards: The Thomson Reuters Trust Principles.