The attack came after Prime Minister Lee Hsien Loong vowed to hunt down culprits who launched cyber-attacks on Singapore, reported Xinhua.
The Infocomm Development Authority said early on Friday that "a sub-page for search on the prime minister's office website was reported to be compromised" at 11.17 p.m. on Thursday.
"A vulnerability in that sub-page was exploited to display pages from other sources. This vulnerability is known as cross-site scripting," it said.
The sub-page of the website once showed a mocking headline "It's great to be Singaporean today" next to a Guy Fawkes mask, a symbol of anti-establishment defiance.
The main website of the prime minister's office is still working, the authority said.
It added that it is working to restore the page that has been compromised and that investigation is ongoing.
Apparent members of Anonymous recently uploaded a video message threatening to attack the information infrastructure of the Singapore government, urging it to reconsider a regulatory framework that requires influential news portals to be licensed.
The websites of local daily Straits Times and a secondary airport were hacked.
Lee said on Wednesday that Singapore authorities will "spare no effort" to track down culprits who launch cyber-attacks even though they think they can hide behind the internet's veil of anonymity.
"It is not a laughing matter. It's not just anything goes, and you're anonymous, therefore there's no responsibility. You may think you are anonymous. We will make that extra effort to find out who you are," he said.
Lee acknowledged that no cyber security precautions are perfect, but the government is making efforts to boost the systems to reduce vulnerability.