Officials said the explosion occurred during an event of the governing People's Democratic Party in Suleja, about 24 miles from the African nation's capital, the BBC reported Friday.
The bomb was tossed from a vehicle toward the middle of the crowd, but missed and landed near a market, national police spokesman Olusola Amore said.
"Three people were killed on the spot and 21 wounded," Amore said.
No one has claimed responsibility for the incident and no arrests have been made, he said.
Officials said the attack occurred after the main portion of the rally ended and that PDP candidate Babangida Aliyu was uninjured.
National elections are scheduled for April.
Opposition parties had accused the PDP of hindering their ability to conduct campaign rallies as the election nears, the BBC said. Presidential candidates from three opposition parties said they were having difficulty getting the necessary rally permits in the states of Ebonyi, Benue and Niger.