The Devil runs a computer simulation to analyze souls to determine individual weaknesses to exploit. The program settles on Elliot Richards (Brendan Fraser), a geeky, over-zealous man working a dead-end job in a San Francisco computer company. He has no friends and his co-workers avoid him. He has a crush on colleague Alison Gardner (Frances O’Connor), but lacks the courage to ask her out. After Elliot is ditched by his co-workers at a bar while trying to talk to Alison, he says he would give anything for Alison to be with him. The Devil, in the form of a beautiful woman (Elizabeth Hurley), overhears him and offers to give Elliot seven wishes in exchange for his soul.

As a test, Elliot wishes for a Big Mac and a large Coke. The Devil takes him to McDonald’s and places the order. Elliot has to pay for it, because, “there ain’t no such thing as a free lunch.” After taking Elliot to her office, based at a nightclub in Oakland, the Devil convinces Elliot to sign her contract, and delivers further wishes. Each wish has Elliot living them out with Alison and his co-workers in surrogate roles. However, the Devil always spoils his wishes by adding something he does not expect or want.

After going through five wishes, Elliot is arrested after confessing his story to a priest who believed he was drunk. The Devil, dressed as a police officer, throws him in a cell, telling him that she likes him, and it would not hurt to have her as a friend. Elliot’s cellmate tells him that he cannot sell his soul as it belongs to God, and although the Devil may try to confuse him, in the end he will realize who he truly is, and what his purpose is. Elliot questions the man as to his identity, but the response is simply “a really good friend”.

Elliot asks the Devil to cancel their contract. When the Devil refuses, Elliot states he will not use his final wish. The Devil teleports them to Hell. When the Devil pushes him to make a final wish, Elliot wishes that Alison could have a happy life – with or without him. The Devil sighs and Elliot falls into the depths of Hell. He wakes up on a marble staircase, wondering if it is Heaven. The Devil tells him that a provision in the contract’s fine print states that a selfless wish voids the contract. Elliot admits that despite her manipulation of him he has come to like the Devil and regards her as a friend. She advises that Heaven and Hell can be found on Earth; it is up to humans to choose. Elliot asks Alison out, but discovers she is already dating another man. He continues with his life, with a better understanding of who he is.

Later, Elliot is confronted by Bob, one of his co-workers, who ridicules Elliot at the encouragement of his co-workers. Elliot grabs a terrified Bob by the shirt, but lets go, simply saying, “Nice talking to you.” At home, he meets a new neighbor, Nicole, whose looks resemble Alison’s but whose personality, interests and fashion sense are much closer to his. He offers to help her unpack and they begin a relationship. While the two walk along a boulevard, the Devil and Elliot’s cellmate, both dressed in white, are playing chess and looking at Elliot and Nicole. The Devil attempts to fix the game but gets caught by the guy, who laughs and lets her continue cheating. The Devil’s computer program lists Nicole and Elliot’s foibles, which they tolerate.