First of all, New York Estates, Powers and Trusts Law sec. 5-1.1(f) provides that a spouse may waive the elective share:
(f) Waiver or release of right of election.
(1) A spouse, during the lifetime of the other, may waive or release a right of election, granted by this section, against a particular or any last will or a testamentary substitute, as described in subparagraph (b)(1), made by the other spouse. A waiver or release of all rights in the estate of the other spouse is a waiver or release of a right of election against any such last will or testamentary provision.
(2) To be effective under this section, a waiver or release must be in writing and subscribed by the maker thereof, and acknowledged or proved in the manner required by the laws of this state for the recording of a conveyance of real property. [i.e. notarized]
(3) Such a waiver or release is effective, in accordance with its terms, whether:
(A) Executed before or after the marriage of the spouses.
(B) Executed before, on or after September first, nineteen hundred sixty-six.
© Unilateral in form, executed only by the maker thereof, or bilateral in form, executed by both spouses.
(D) Executed with or without consideration.
(E) Absolute or conditional.
Let’s assume that the lawyer who drafted up the pre-nup knew what he or she was doing and included a properly executed waiver of the elective share.
What we have here is the intersection of the law of decedent’s estates and the law of contracts. Under estate law, the decedent’s property, after the payment of all justly due debts and expenses of administration, is distributed according to the decedent’s will (subject to the elective share, which we’re considering waived here and other matters not relevant to our discussion).
Assuming that the decedent has properly executed the final will disinheriting the spouse, and the decedent was of sound mind and otherwise had testimentary capacity, the will would be enforcable as written, and the spouse would not inherit the $5 million under the will.
However (and this is the big however), the property distributed under the will is the property remaining after the payment of debts. Under the pre-nuptual agreement (assuming it has been properly executed and otherwise valid), the deceased spouse had entered into a contract under which he agreed to give his spouse $5 million on his death. When he changed his will, he breached that contract, and the surviving spouse is entitled to sue for the damages that she suffered due to that breach, namely the $5 million she is not receiving under the will.
Assuming all of this to be true, the surviving spouse would be entitled to her $5 million from the decedent’s estate, but as a matter of contract law, rather than directly under the will.
(Note that I am not an estate lawyer, nor your lawyer. If you are planning to marry or die, please consult someone qualified in your jurisdiction.)