A hammer-wielding thief attacked a straphanger as he paid for a MetroCard in a Brooklyn subway station, cops said.

The victim was at the Fulton Street and Rockaway Avenue station in Brownsville when he was attacked from behind by the suspect Wednesday around 9:20 p.m., according to police.

The crook fled with the man’s belongings.

The victim was rushed to Brookdale Hospital for treatment and later released, authorities said.

The suspect is believed to be 5-foot-10 and was caught on video surveillance.