The militants targeted villages under government control, and clashed with the army and its militia allies.
The UK-based Syrian Observatory for Human Rights (SOHR) said at least 15 of the dead were civilians.
The fighting is near a strategically important highway linking Hama city with the Aleppo area further north.
The SOHR said at least 27 government troops or militia were killed in the attack, on the villages of Aqareb and al-Mabujeh. Another 10 bodies had yet to be identified.
Some of the civilians killed were put to death after being captured by IS, the observatory added.
State news agency Sana also reported the attack in Aqareb, saying 20 civilians were killed there, but made no mention of al-Mabujeh.
Why is there a war in Syria?
IS was now fully in control of Aqareb, SOHR said, adding that the government had sent reinforcements to the area.
Hama province is divided three ways between government forces, rebels and IS, with the militants mainly occupying the eastern part.
More than 50 people are reported to have been killed in heavy fighting in Syria after so-called Islamic State launched an attack in Hama province.