With the passage of the bill, Madhya Pradesh becomes the first state in the country where those convicted of such rapes will face the gallows.
Introduced in the House by Law and Legislative Affairs Minister Rampal Singh, the bill was discussed in detail and then passed by all parties, including the ruling BJP and opposition Congress.
The bill will now be sent to the President for his assent after which it will become a law, state Home Minister Bhupendra Singh told reporters outside the Assembly.
"It was a historic day for Madhya Pradesh as the state Assembly, as per the wish of Chief Minister Shivraj Singh Chouhan, passed a bill making a provision to award capital punishment to those indulging in such crimes (raping girls aged 12 or younger)," Mr Singh said.
Capital punishment will be awarded to convicts under section 376 (A), which is related to rape, and section 376 (D, A), pertaining to gang rape.
Welcoming the bill, Chief Minister Chouhan said, "There are people in society who can be set right only by severe punishments. It (the legislation) will deal with them. We will also raise awareness in society against such crimes."