During a particularly intense Florida heatwave, inept lawyer Ned Racine (William Hurt) begins an affair with Matty (Kathleen Turner), the wife of wealthy businessman Edmund Walker (Richard Crenna). They go to great lengths to keep their affair a secret, but Ned carelessly propositions an old school friend of Matty, Mary Ann Simpson (Kim Zimmer), thinking she was Matty. Matty soon makes it clear to Ned that she wants to leave Edmund but also wants his money, explaining that a divorce would leave her with very little due to their prenuptial agreement. Racine suggests the only option is to kill Edmund. While planning the murder, Ned consults one of his shadier clients, Teddy Lewis (Mickey Rourke), an expert on incendiary devices, who supplies him with a bomb.
Racine drives to the Walker estate at night to kill Edmund. He places the body in an abandoned building in which Edmund had a business interest, and uses the incendiary device to make it look like he died during a botched arson job. Ned is contacted by Edmund's lawyer about a new will that Racine supposedly drew up on Edmund's behalf, which was witnessed by Mary Ann Simpson. The new will is so poorly prepared it is declared null and void, resulting in Matty inheriting the entire fortune. Matty later admits to Ned that she forged the will.
Two of Ned's friends, assistant deputy prosecutor Peter Lowenstein (Ted Danson) and police detective Oscar Grace (J.A. Preston) begin to suspect Ned of involvement with Matty in her husband's death. The men reveal to Ned that Edmund's steel-rim glasses, which he always wore, were not on him at the time of the explosion, and are nowhere to be found. Mary Ann Simpson has also disappeared. Nervous about the will, the glasses, the suspicions of the police, and Matty's loyalty, Ned happens upon a lawyer who once sued him over a mishandled legal case. The lawyer reveals that to make amends, he recommended Ned to Matty Walker, and admits to telling her about Ned's lack of competence as a lawyer.
Lowenstein warns Ned that someone kept calling his hotel room on the night of the murder but never got an answer, thereby weakening his alibi. Lewis tells Ned that a woman came to him for another incendiary device, and he showed her how to booby trap a door. Matty calls Ned to tell him the glasses are in the boathouse on the Walker estate. Ned goes to the boathouse late at night and sees a long twisted wire attached to the door. When Matty shows up, Ned confronts her at gunpoint and tells her to get the glasses. Matty walks toward the boathouse and disappears from view; the boathouse explodes. Grace finds a body that is identified as Matty Walker (nĂŠe Tyler) through dental records.
Now in prison, Ned tries to convince Grace that Matty is still alive, laying out for him the scenario that the woman he knew as "Matty" assumed the identity of Matty Tyler in order to marry Edmund and get his money. The woman Ned knew as "Mary Ann Simpson" discovered this and played along but was then murdered and her body left in the boathouse. Had Ned been killed by entering the boathouse, the police would have found both suspects dead, and "Matty" would have gotten away with the money.
Remembering that Matty told him when and where she had attended high school in Illinois, Ned writes to the school asking for the yearbook. Ned finds the pictures of Mary Ann Simpson and Matty Tyler, confirming his suspicion that Mary Ann Simpson stole Matty Tyler's identity, eventually becoming Matty Walker. Below the real Matty's picture is the nickname "Smoocher" and "AmbitionâTo Graduate"; below Mary Ann's is the nickname "The Vamp", swim-team membership, and "AmbitionâTo be rich and live in an exotic land".
Mary Ann is last seen seated on a comfortable chair on a tropical beach. Reclining beside her is a man who speaks to her in Spanish. Lost in thought, Mary Ann turns away from him, puts on her sunglasses and faces the sun.

Question: Who does Ned Racine have an affair with?
Answer: Matty
Alternative answer: Matty