Largely considered Woody Allen’s greatest and best-loved film, Annie Hall was released in 1977 to wide critical and commercial success. The film, which Allen cowrote, directed, and starred in, tells the story of a failed romance within the frame of 1970s–era New York City—a romance based loosely on Allen’s real-life relationship with actress Diane Keaton, whose given name was Diane “Annie” Hall. Annie Hall won four Academy Awards, including Best Picture, and firmly established the comic genius of Woody Allen and the remarkable acting talent of the young Diane Keaton. It is a hilarious but poignant work, remembered as much for its culturally referential wit as for the endearing relationship that unfolds amid the punch lines.

Allen made Annie Hall after releasing five previous films, all of them satires of specific film genres or literary canons. These films, which include Take the Money and Run (1969) and Love and Death (1975), benefited from frequent moments of slapstick. With Annie Hall, Allen set out to make a broader film focused less on comedy and more on storyline. Cowritten with Allen’s cabaret colleague Marshall Brickman, Annie Hall was originally conceived as a murder mystery, but the mystery idea was soon dropped as the quirky romance storyline began to stand out in the script. At the time, the Hollywood movie-making system was in full gear, and the studios were preoccupied with large-scale blockbusters, as well as dealing with some major embarrassments—director Roman Polanski fled the United States to escape a statutory rape conviction, and director Francis Ford Coppola’s huge project Apocalypse Now (1979) was costing so much time and money that it became a prime target of media mockery. In this cinematic environment, Annie Hall stood apart as a refreshing comic masterpiece made entirely outside of the glamorous, profit-oriented Hollywood system.

Making movies seems to serve an almost therapeutic function for Allen. Though relatively reclusive in his personal life—he refused to go to the Academy Awards, where Annie Hall took home four Oscars, in favor of playing his weekly jazz gig in a Manhattan club—he has few qualms about exposing his innermost thoughts on screen. Allen’s own struggles and complexes, especially in relation to women and sex, saturate many of his films, and it often becomes hard to separate Allen from the characters he writes and inhabits as an actor. Alvy, the protagonist of Annie Hall, is, like Allen, a pessimistic, Jewish stand-up comedian who is constantly paranoid. Add to those similarities the fact that the film is based, albeit loosely, on Allen’s real-life romance, and it becomes difficult to distinguish autobiography from fiction. Allen uses this confusion to his benefit and experiments with direct address and other self-conscious techniques in the film.

Allen’s work is not drawn solely from his own experiences, however. In Annie Hall, he takes comic inspiration from the Marx Brothers and cinematic inspiration from filmmakers like Federico Fellini, who gets a tongue-in-cheek nod in a theater lobby scene, and Ingmar Bergman, whose onscreen tricks inform much of Annie Hall’s visual invention. But what most permeates the film is the ideology of Sigmund Freud, whose theories about the mind Allen treats both seriously and irreverently within the film. Annie Hall uses what could be called a Freudian chronology, as its story is told with a trajectory that seemingly parallels Alvy’s stream of consciousness. Allen pays tribute to Freud’s influences at several points in the film, perhaps most notably during the second joke he tells in his opening monologue, which refers to both Freud and Groucho Marx. Allen also found a muse in his hometown of New York City, which plays a significant part in Annie Hall. Almost as a rule, Allen shoots and edits his films in New York. Annie Hall is shot on location, primarily in Manhattan but also with some scenes from Alvy’s Brooklyn childhood as well as a handful of scenes in Los Angeles, the butt of numerous jokes.

Annie Hall at once established Allen’s reputation as a top American filmmaker and arguably the best comic filmmaker of the latter half of the twentieth century. The film is hilarious to be sure, but its humor never supersedes its story and indeed would dim without it. The combination of endearingly awkward romance and agitated, self-absorbed humor sets Annie Hall apart as a different sort of intelligent romantic comedy—one that doesn’tend in marriage and one that remains firmly ingrained in its time period and geographical space. And although some of the film’s 1970s–specific one-liners might seem foreign to younger viewers, the image of Alvy, nervous and sweaty after a game of tennis, and Annie, decked out in her now-famous vest and tie, is lasting.