Crowds gathered outside the house of a local politician whose relative was accused of making the post about Prophet Muhammad, reports BBC.
They set fire to vehicles and attacked policemen who arrived on the scene with stones, police told BBC.
Police have arrested the man, and also 110 others who were in the crowd.
City commissioner Kamal Pant said that at least 60 policemen including senior officers were injured in the violence on Tuesday night. Curfew was also imposed in two police districts of the city, he said.
The deaths were confirmed by the home minister of Karnataka state of which Bangalore is the capital.
The violence started after protesters massed outside the politician's house as well as a police station after spotting the post, which local media say has since been deleted.
Meanwhile, the lawmaker, Akhanda Srinivas Murthy, made a video appeal to protesters to stay calm and promised them justice.