A down-on-his-luck former comic-book writer who claims he created the “Ghost Rider” character is gearing up to battle Marvel Comics for the valuable rights to the supernatural superhero.

A Manhattan appeals court today re-instated Gary Friedrich’s suit over the cartoon biker with a flaming skull for a head, who was portrayed by longtime fan Nicolas Cage in a 2007 movie that grossed more than $228 million worldwide.

Friedrich sued Marvel shortly after the film’s release, insisting that he owns the renewal copyrights to Ghost Rider, related characters and origin story after creating them for the fifth issue of “Marvel Spotlight” in 1972.

A judge tossed that suit and found Friedrich liable for $17,000 in damages after Marvel — which contends that Ghost Rider was a team effort — counter-sued him for “exploiting” his connection to the character during appearances at comic-book conventions during the early 2000s.

But a three-judge Manhattan appeals court unanimously reversed that decision and ruled that Friedrich, 69, deserves a trial over a 1978 “work-for-hire” agreement in which Marvel claims he signed away the renewal rights to Ghost Rider.

Friedrich wasn’t paid anything for inking that pact, which his lawyers say was demanded in exchange for the promise of future writing gigs that never materialized.

In a 48-page ruling, Judge Denny Chin of the US Second Circuit Court of Appeals called the agreement “ambiguous on its face,” with a “critical sentence” written in a way that’s both “ungrammatical and awkwardly phrased.”

Chin also said the one-page deal “contains no explicit reference to renewal rights,” noting that by then Ghost Rider’s debut story “had grown so popular that Marvel had already reprinted it once and had launched a separate ‘Ghost Rider’ comic book series.”

“Given that context, it is doubtful the parties intended to convey rights in the valuable Ghost Rider copyright without explicitly referencing it,” Chin wrote.

After struggling with alcoholism in the late 1970s, Friedrich quit the comics business and most recently worked as an overnight courier, but was forced to quit that job due to failing sight and hearing, according to his lawyers.

Friedrich, of Arnold, Mo., didn’t return messages seeking comment, but lawyer Charles Kramer said he would fight “aggressively and vigorously” to secure the Ghost Rider copyright, which could be worth “at least in the high tens of millions” of dollars.