Voters took to the internet to accuse the Government of trying to steal the election, as indelible ink that Razak touted as a guarantee against voter fraud was found to wash off easily. There were also claims of bogus ballots.
Najib urged all Malaysians to accept the result.
"We have to show to the world that we are a mature democracy," he said.
Monitoring groups including Coalition for Clean and Fair Elections, known as Bersih, said there had been an "improvement in the conduct of the election" despite a number of "major issues".
The wave of enthusiasm in the run-up to polling day and the strong turnout confirmed the country had entered two-party democratic politics for the first time since independence from Britain.
Nurasyqin Abdul Fattah, 21, a first-time voter, was one of around 2.6 million new registered voters, making up about 25 per cent of the electorate, who were vital to the outcome.
"I've been here for over an hour. Then we have to go to another district for me to vote. I don't mind, though, I am so excited," she said. "Something is going to change today. We Malaysians are voting for a leader, a government, that is not racist."
Three well-known Cabinet ministers and at least one state chief minister lost their seats. In the district of Lembah Pantai, dejected BN supporters gathered in an election tent, after the party's candidate lost to Anwar's daughter, Nurul Izzah Anwar.
Volunteer Mona Abdullah, 50, who was disappointed for the losing candidate, Raja Nong Chik Zainal Abidin, felt it was unfair to claim the ruling alliance was not reflecting change in Malaysia.
"There has been lots of wrong information going around in this election, the Opposition always feel what we're doing is not right," she said.
"Malaysia is changing; it has changed. There are now better channels of communication, you can even talk to our Prime Minister on the web. I hope people will understand that it doesn't matter if the ruling party is re-elected, they are still listening to the people."
A few streets over, the scene was more jubilant in the Opposition tent where people watched the results intently while eating fried chicken.
"We won here, people love our party," beamed Baljit Kaur, 43, a volunteer for the Pakatan Rakyat.
"Change is the main subject of the current election," Kaur's fellow electioneer Raj Lingam, 50, said.
"The country is not changing, it's the people. I've voted seven times, this time we're voting for a better government, against corruption and discrimination. The younger generation are more eager and want change."