The attack in the city of Peshawar was the latest in a spasm of violence in the area, showing that Pakistani Taliban militants retain the capacity to strike.
The army has claimed success in its fight against the militants, who are behind five years of violence in the country, but the insurgents have proved resilient.
Peshawar has been a frequent target of militant attacks over the last few years, but most have been bomb blasts, not coordinated assaults in the center of the city such as Friday's attack.
City police chief Imtiaz Altaf said three militants entered the compound after attacking the main gate, then blew themselves up when police returned fire, he said.
"They wanted to occupy this police station, but they failed," he told reporters.
Four policemen were killed and six wounded in the attack, said police officer Sattar Khan.
There were more than 370 policemen at the station at the time of the assault, said provincial Information Minister Iftikhar Hussain.
The number of policemen was so high because authorities send graduates of the police training academy to the station for 18 months before stationing them at other posts.
Pakistani Taliban spokesman Ahsanullah Ahsan told The Associated Press the attack was carried out by an affiliated group, the Abdullah Azzam Brigade.
Abu Zarar, a man who claimed to be a spokesman for the Abdullah Azzam Brigade, also told the AP that the group executed the attack. He said it was in response to the death of one of the group's commanders, Badar Mansoor, in a U.S. drone strike on Feb. 9.
Mansoor served as a key link between the Pakistani Taliban and al-Qaida. He led a group of over 200 Pakistani Taliban fighters in the North Waziristan tribal area, where he was killed.
Ahsan, the Taliban spokesman, denied the group carried out a car bombing that killed 12 people at an outdoor minibus terminal in Peshawar on Thursday.
The militants often deny carrying out attacks that kill civilians, blaming the Pakistani government and the United States.