Star Wars is a story of aliens and space battles; but it's also a story of ghosts and mystical powers. Is Star Wars science fiction, or is it fantasy? More importantly, what makes it one or the other?
Magic vs. Science
The difference between sci-fi and fantasy is a much-debated subject. One common dividing line, however, is that science fiction is about scientific and technological advancements that could reasonably occur in the future, while fantasy exists only in the realm of imagination.
Much of Star Wars does deal with advanced technology, which seems to put it in the realm of science fiction. We may not have hyperdrives that allow for interstellar travel, but we can easily see manned spaceships that travel to other planets as a natural progression from traveling to the moon and sending unmanned probes to other planets in our solar system. Some of the technology in Star Wars is not even that far off; for example, scientists have already been able to create miniature lightsaber-like devices.
The existence of the Force, however, makes Star Wars seem more like fantasy than science fiction. The Force is a mystical energy field which gives Jedi seemingly magical powers, and the study of the Force is more like a religion than a science. The idea of midi-chlorians, microorganisms in the blood, attempts to provide a scientific explanation for the Force; but even midi-chlorians cannot explain how the Force can make bodies disappear or allow beings to become ghosts after death.
Hard Sci-Fi vs. Space Opera
Sci-fi and fantasy have many subgenres, each with their own common elements. One subgenre is "hard sci-fi," or sci-fi concerned with scientific accuracy. The author of a hard sci-fi work might, for example, do extensive research to make sure the spaceship she created works under known scientific principles. The author of a "soft sci-fi" work, on the other hand, might be comfortable just saying that the spaceship works; exactly how is not important to the story.
Star Wars falls into the subgenre of "space opera," which takes many of its elements from adventure fiction. Space opera involves plots, battles, characters and abilities on a huge, dramatic scale -- all of which is true of Star Wars. Technology and other scientific elements in Star Wars are often scientifically inaccurate or merely given a scientific flavor; for example, the midi-chlorian explanation for Force-sensitivity.
In much of hard sci-fi, the science is the story; in Star Wars and other space opera, the science is a backdrop for the real story. This doesn't make Star Wars any less science fiction.
While it may feel like a cop-out, the best answer to whether Star Wars is sci-fi or fantasy is that it's a little bit of both. Calling Star Wars "sci-fi" ignores its fantasy elements, such as the Force; but calling Star Wars "fantasy" ignores its interplanetary setting and sci-fi feel.
The best label for Star Wars may be "science fantasy," a subgenre that blends elements of sci-fi and the supernatural. There's no need to force Star Wars into a sci-fi or fantasy genre box when its science fiction and fantasy components work together in harmony.