Six others were wounded in the incident which happened around 7:00p.m. in Shamsa Kheil area of Alisheng district, said Asadullah Dawlatzai, a spokesman for provincial governor.
The deaths included a woman and her three children, he said.
The injured people were admitted to a hospital in provincial capital, Mehtarlam, the official said.
There was no immediate claim of responsibility for the attack.
It comes amid increased violence in the country. The Taliban attacked two northern Afghan cities, Kunduz and Pul-i-Khumri in two days.