One man’s dream of flight and an entire nation’s dream of technological and military supremacy give rise to “The Wind Rises,” Hayao Miyazaki’s elegiac, hauntingly beautiful historical drama inspired by the life of aviation engineer Jiro Horikoshi, who designed Japan’s A6M (or “Zero”) fighter plane. As grown-up as 2008’s “Ponyo” was tot-friendly, Miyazaki’s 11th feature draws a sober, socially astute portrait of Japan between the two World Wars, marked by flights of incredible visual fancy, harrowing images of poverty and destruction, and touches of swooning romance. Already a major hit at home (where it has grossed more than $80 million after six weeks in release), “Wind” will prove a trickier sell offshore than the helmer’s more familiar fantasy adventure pics, but should soar with animation and aviation buffs, and discerning arthouse goers of all stripes.

If “The Wind Rises” feels like a particularly personal project for Miyazaki, it’s because the director’s father ran a factory that produced rudders for the A6M, seeding in the young Miyazaki a lifelong fascination with real and imagined flying machines. In addition to his two films centered around fantastical airborne residences (“Castle in the Sky,” “Howl’s Moving Castle”), he directed a 2002 short on the history of flight for exhibition in his Studio Ghibli museum.

But the Miyazaki film with the strongest connection to his latest is 1992’s “Porco Rosso,” in which the title character was an Italian WWI flying ace transformed into a pig and the landscape is the rise of European Fascism in the years preceding WWII. That pic’s fictional aircraft manufacturer, Piccolo, was widely noted to be based on the real Italian aviation pioneer Giovanni Caproni, who appears in “The Wind Rises” as a kind of spirit guide, visiting Horikoshi in his dreams and uttering the Paul Valery quotation from which pic takes its allusive title: “The wind is rising! We must try to live!”

Those words become a rallying cry of sorts for the endurance of the human spirit in a movie where the characters’ personal defeats and are juxtaposed against Japan’s national tragedies of the 1920s and ’30s, including the Great Depression, the 1923 Kanto earthquake, a deadly tuberculosis epidemic and the looming shadow of WWII. Indeed, “Wind” is easily the most realistic film Miyazaki has made, with one of its running themes being the power of imagination to turn dreams into reality, and how quickly those same dreams can become nightmares.

The film’s Jiro — actually a fictionalized mix of Horikoshi and the Tubercular novelist Tatsuo Hori (to whom the pic is collectively dedicated) — is first seen as a boy living in a fog-shrouded rural prefecture where, too nearsighted to ever fly a plane, he instead yearns to build them. He obsessively reads English-language aviation magazines with the aid of a dictionary and enjoys his first nocturnal meeting with Caproni, who offers the boy a tour of his own dream aircraft: the triple-winged transatlantic passenger plane known as the Caproni Ca.60 (whose only prototype crashed during a 1921 test over Lake Maggiore — events depicted later in the film).

“Wind” then flashes forward to 1923, where Jiro (well voiced by Miyazaki’s fellow anime director Hideaki Anno) is now a Tokyo engineering student, returning to the city by train when the earthquake strikes. It is a sequence that ranks with the most visually arresting of Miyazaki’s career, the earth surging up in jagged, violent waves while a belching orange fire chokes the sky. In the ensuing chaos, Jiro meets Nahoko, who will go on to become the great love of his life — though for now she is just a scared young girl, fleeing the derailed train along with her injured nanny.

From there, Miyazaki traces Jiro’s ascent through the ranks of the Japanese aviation industry, his childhood awe at the wonder of flight challenged by the real-world implications of the war machines he finds himself creating. As a rising young star at Mitsubishi, he goes from making fittings for wing struts to leading the team working on a new fighter design, and makes a side trip to Germany where he communes with another storied plane designer, Hugo Junkers, creator of the first all metal-frame aircraft. Throughout, Miyazaki delights in the minutiae of process and detail, and one needn’t look too hard to see Jiro as an avatar for the filmmaker himself, traversing another field — like filmmaking — rooted in a tricky alchemy of art and science.

By the start of the 1930s, Jiro has begun work on the design of a carrier-based fighter that will become the Mitsubishi A5M (the precursor of the A6M). And though Miyazaki has stated that the intention of the film is not to condemn war, “The Wind Rises” continues the strong pacifist themes of his earlier “Nausicaa” and “Princess Mononoke,” marveling at man’s appetite for destruction and the speed with which new technologies become weaponized. On vacation in the countryside, Jiro meets a German expat, Castorp, who quotes from Thomas Mann’s “The Magic Mountain” (a novel whose allegorical portrayal of pre-WWI Europe is echoed in the structure of Miyazaki’s film) and warns of Japan and Germany’s road to ruin. It is also there that Jiro reconnects by chance with Nahoko, now a ravishing young woman, albeit one suffering from TB. Nevertheless, they fall into each other’s arms and “The Wind Rises” takes on yet another dimension — that of an old-fashioned, tragic Hollywood romance.

If that romance is the only part of “Wind” that feels a tad too leisurely in its pacing, it’s a small quibble with a film that otherwise affords so much narrative and sensory pleasure. Miyazaki is at the peak of his visual craftsmanship here, alternating lush, boldly colored rural vistas with epic, crowded urban canvases, soaring aerial perspectives and test flights both majestic and ill-fated. The score by frequent Miyazaki collaborator Joe Hisaishi recalls Nino Rota in its lilting accordion-and-mandolin main theme.

“Airplanes are beautiful dreams,” notes Caproni in one of pic’s fantasy sequences. So, too, this movie about them.