With 18.3 million votes counted on Wednesday after polls in the world's third largest democracy, Megawati's Indonesian Democratic Party of Struggle (PDI-P) had 20.4% compared to Golkar's 19.9%.
But millions of voters have deserted PDI-P compared to the last elections in 1999. Many went to the new Democrat party of Susilo Bambang Yudhoyono, Megawati's likely rival in presidential elections this July.
The National Awakening party of ex-president Abdurrahman Wahid was on 13.7% in the latest count.
The main Islamic grouping, the United Development party led by Vice-President Hamzah Haz, had 8.06%, fractionally in advance of Yudhoyono's Democrats.
In sixth place was the Islamic-based Prosperous Justice party (PKS) with 7.3%.
"We need to evaluate ourselves ... so far, the result is not as we predicted," admitted Pramono Anung, PDI-P deputy secretary-general, quoted by the Jakarta Post.
Anung admitted that his ruling party had "a poor image that hurt the votes".
"We need to evaluate ourselves ... so far, the result is not as we predicted"
deputy secretary-general, PDP-I
Partial results from Bali, for example, showed Megawati's party with 55% of the vote compared to the 79% it secured in the resort island in 1999.
Megawati could now face a struggle to keep her job in the country's first direct presidential vote. She already trails her former security minister Yudhoyono in the presidential race, according to opinion polls.
PDI-P boasted of being the little people's party. But disgruntled former supporters complained of lacklustre economic growth, high unemployment, rising prices, poor social services and corruption.
Half the country's 212 million people live on less than $2 a day, 10 million are jobless and 30 million have only part-time work.
Rustam Ibrahim, one of those involved in the survey, said eight per cent of those who voted for PDI-P in 1999 chose the Democrat party this time and seven per cent shifted to Golkar.
"It appears as if the PDI-P is getting punished in the elections because they did not pay attention to the interests of the wong cilik (little people)," he said.
Voters may have turned to the Democrats to smooth Yudhoyono's path to the presidency, he said.
Yudhoyono, a soft-spoken and popular former general, quit his ministerial post last month. He complained that Megawati was freezing him out of her coalition cabinet because of his leadership attempt.