The team of two vaccinators was unharmed, police said.
Local polio vaccination teams are often targeted by anti-vaccine militants, some of whom claim vaccination is a Western plot to sterilise Muslims.
Pakistan and Afghanistan are the only countries where polio, which in severe cases can be fatal or leave patients paralysed, remains endemic.
The two gunmen had been hiding near a small water channel before opening fire on the guards from a "very close range", local police said.
"The gunmen spared the two-member polio vaccination team... and fled on a motorbike," senior officer Waqar Ahmad Khan told AFP.
The incident happened in Kot Azam, Tank district, in north-west Pakistan.
Many polio workers and their guards have been killed by militants in Pakistan over anti-vaccine sentiment, which includes the belief that the vaccines contain pig fat.
Opposition grew after the CIA staged a fake vaccination drive to help track down al-Qaeda founder Osama Bin Laden.