With over 90 percent of the votes counted, ruling PJD wins 125 seats while rival the Authenticity and Modernity Party (PAM) gets 102 seats in the 395-seat parliament, according to the results announced so far.
Morocco's governing Justice and Development Party (PJD) won the most seats in Friday's parliamentary election in the country's second poll since it adopted constitutional reforms in 2011.
Elections for the House of Representatives were a test of Morocco's constitutional monarchy five years after the king devolved some limited powers to elected government to ease protests for democratic change in the kingdom.
With 90 percent of the votes counted PJD had won 125 seats, while rival the Authenticity and Modernity Party (PAM) had 102 seats, according to the results announced by the interior minister.
The minister said counting for another 90 seats set aside for women and youth lawmakers was still ongoing.
No party can win the majority in the vote for the 395-seat parliament under Morocco's system. Additionally, the winner must form a coalition government. The king retains executive power and chooses a premier from the winning party.
With PAM scoring high in the tight race, PJD will need to partner with at least three other parties to secure a parliamentary majority.
After PJD won the 2011 election, the king appointed Abdelilah Benkirane as prime minister. In the last five years, he has pushed economic reforms to reduce the deficit and tackle subsidies.
"The Moroccan people voted for PJD massively," Benkirane told reporters.
The PJD is one of the only remaining parties leading a government after the Arab Spring revolts toppled long-standing leaders in Libya, Egypt and Tunisia.
But, citing king's tight grip on power, Morocco's main opposition group, Justice and Spirituality, and some left-wing organisations have boycotted the election in protest.
PJD's main rival, PAM, founded by a close friend of the king who is now a palace adviser, had presented itself as a liberal alternative to PJD.
Although palace officials denied any favouritism, campaigning was marked by accusations that the royal establishment was unfairly backing PAM as a way to roll back PJD influence.
Hours before polls closed on Friday, the PJD accused local officials under the control of the Interior Ministry of trying to influence voters. The ministry has dismissed some claims and said it would investigate others.
The North African kingdom presents itself as a model for economic stability and gradual reform in a region where violence and instability are more the norm.