Illustration from H. Rider Haggard's The Ivory Child (1916).
Today it's no great revelation that Melville uses a number of typically Gothic elements in Moby-Dick. There's even a Yahoo! Answers answer on the subject. Back in 1949, Newton Arvin -- a far greater authority than any of us anonymous Internet wayfarers -- wrote a highly readable article on Melville's Gothic touches, "Melville and the Gothic Novel" (New England Quarterly, vol. 22, no. 1, 33-48 [available at JSTOR with free registration]). As Arvin observed, Melville's imagination was "profoundly Romantic, in one of the largest senses of the word, ... and to say so is to say, especially for an English or American writer, that the Gothic or Radcliffean was almost certain to be a minor ingredient in its complex totality."
Consider, for instance, the (usually female) protagonist who slowly begins to realize, with ever increasing dread, that she has become caught in the power of a man both tyrannical and malevolent. For post-Moby-Dick examples, think of Laura Fairlie in The Woman in White (1859) or Maud Ruthyn in Uncle Silas (1864) or Jonathan Harker in the first four chapters of Dracula (1897). In Moby-Dick, Ishmael's misgivings about the voyage and about Captain Ahab in particular slowly accumulate as he considers the "wicked king" who bore Ahab's name, the dark hints from Elijah, and other red flags. By the time Ishmael's fears are confirmed in "The Quarter-Deck" (Ch. 36), he has effectively no escape from Ahab's grasp.
(Critics have noted the overall passivity of Jonathan Harker -- a male narrator filling the Gothic role of the young maidenly heroine around whom older, stronger figures are spinning their webs. In one of Dracula's most memorable scenes, Harker lies supine at the mercy of three predatory females, fearing and desiring their kisses/bites. Interestingly, the passivity of the mild-mannered Ishmael, another male narrator in the role of the Gothic heroine, becomes explicit in his relations with Queequeg. Awaking in bed with the thoroughly masculine Queequeg's arm around him, Ishmael acquiesces in the embrace, and later he figuratively becomes Queequeg's wife. And in both narrators, their passivity is abetted by the vulnerability of their positions as employees -- Harker the young solicitor who wants to please a rich client, Ishmael the lowly greenhand put upon by mates and captain.)
While Moby-Dick carried forward much of the Gothic machinery developed in the previous century by Ann Radcliffe and others, it also paved the way for what is sometimes termed Imperial Gothic. Imperial Gothic is a sub-genre that flourished around the end of the nineteenth century. It is best exemplified by the lost-world fantasy-adventures of Conan Doyle and H. Rider Haggard, in which intrepid explorers venture beyond the farthest reaches of the English Empire, into such as-yet-unexplored regions as central Africa, and there confront "the Other" in the form of prehistoric peoples, dinosaurs, giant crabs, witches, and supernaturally vicious elephants and apes.
A modern example of the Imperial Gothic form that will be more familiar than Conan Doyle's and Rider Haggard's ripping late-Victorian yarns is the 1933 film King Kong. Following the standard structure, the film uses the trip to a distant, uncharted location to instill in the audience Gothic terror -- i.e., the fear of the unknown, of an evil that is sensed but cannot (yet) be fully articulated. From the start, we are given hints that the protagonists are on their way toward something horrifying: movie director Carl Denham, famous for wildlife films made at great personal risk, is outfitting for his greatest undertaking yet; he's been having trouble finding any actress willing to appear in the film; the ship he's chartered is loaded with enough explosives and ammunition to blow up New York harbor; the island he's headed for is not shown on any map, its only inhabited portion cut off from the rest by a gigantic wall built centuries ago by a people far more civilized than the current natives -- evidently to "keep something out."
Melville did much the same thing 80 years earlier. The United States at the time did not have an empire strictly speaking, but whalemen were the pioneers of its commercial empire in the Pacific, as Ishmael explains in "The Advocate" (Ch. 24). The Pequod travels to the farthest ocean wastes to encounter Moby-Dick, the unnatural, the monster, the Gothic horror. Like the scriptwriters for King Kong, Melville builds up in his audience a fear of the approaching unknown. The monstrous painting in the entry of the Spouter-Inn, the cenotaphs in the Seamen's Bethel, the backstory of Ahab's disfigurement and ensuing delirium, the spirit-spout, all the sidebars about the great size and strength of the sperm whale and the dangers involved in hunting it -- these are just a handful of ways in which Melville creates dread in the reader as the Pequod sails farther from the safe world of civilized America and closer to the deadly clash with Moby-Dick.