NEW YORK — Taking a superherolike punch at Marvel Enterprises, a federal court in Gotham ruled Wednesday that legendary comicbook creator Stan Lee is entitled to a 10% slice of profits from movies and TV productions based on Marvel characters — including the “Spider-Man” movies.

But Marvel isn’t planning on whipping out the checkbook anytime soon, saying in a statement that it would appeal the ruling.

If it’s not successful, Marvel could have to pay Lee — the company’s chairman emeritus and co-creator of numerous characters such as Spider-Man and X-Men — many millions of dollars.

There was a loose dollar figure of $10 million tied to Lee’s suit, but he could get well more than that if the order stands, not to mention additional profits from projects now in the works, such as the upcoming pic “Fantastic Four.”

In his ruling, U.S. District Court Judge Robert W. Sweet said Marvel took in profits of $50 million alone for the first “Spider-Man” movie. That means Lee would be entitled to $5 million for that.

Sweet also said Lee is entitled to 10% of the profits from movie-related toys sold by Marvel itself, potentially upping Lee’s pot by many more millions.

Howard Graff, Lee’s attorney, said Sweet’s ruling represented a “sweeping victory” but that he hasn’t calculated exactly how much Lee could be owed, considering both merchandise and various films.

Sweet said he would leave it up to a jury to decide whether Lee is entitled to share in profits from Marvel’s joint licensing partnerships with Sony Pictures Entertainment for merchandise based on the “Spider-Man” pics and with Universal Studios for merchandise based on “The Hulk.”

“I am very gratified by the judge’s decision, although, since I am deeply fond of Marvel and the people there, I sincerely regret that the situation had to come to this,” Lee said in a statement.

“We intend to appeal those matters on which we did not prevail and to continue to contest vigorously the claims on which the court did not rule,” Marvel general counsel John Turitzin said, adding that he did not expect the ruling to impact the company’s financial forecasts.

In the quarter ended Sept. 30, Marvel generated $69 million in licensing revenue from movies and TV projects and merchandising, with a large chunk likely coming from “Spider-Man 2” box office sales. Figure excludes merchandising for “Spider-Man 2.”

Sweet’s ruling took Marvel to task for playing semantics with Lee’s employment contract.

Throughout the legal battle, Marvel has argued that Lee was entitled only to enjoy participation in production deals in which Marvel was afforded rights of net profit participation, commonly referred to as “Hollywood accounting.”

But Sweet took issue with Marvel’s interpretation, saying Lee was entitled to participate in all production deals. He pointed out that since 1998, Marvel has mostly struck gross-participation deals with studios and scolded Marvel for not abiding by the intent of Lee’s employment agreement.

“This deceptively simple language, drafted by a company and an executive both skilled and experienced in the industry, has given rise to a multimillion-dollar controversy because of changes in the way Marvel has conducted business since the execution of the agreement in November 1998,” Sweet said.

Lee, 82, joined Timely Comics in 1940; New York-based company was eventually renamed Marvel. Down through the years, he created or co-created Marvel characters including Daredevil, the Fantastic Four, Iron Man, Doctor Strange, the Silver Surfer and Spider-Man. He held a number of different titles and, in 1980, moved from New York to run Marvel’s movie operation.

Lee, who also is chair-CEO of POW! Entertainment in L.A., draws an annual salary of $1 million from Marvel that he will continue to receive until his death.

Lee filed his suit in November 2002 on the heels of the wildly successful release of “Spider-Man,” which grossed more than $830 million worldwide. He argued that Marvel wasn’t living up to a 1998 employment contract, which guaranteed him 10% of Marvel’s share of movie and TV production profits.

Marvel’s profits from the 2004 “Spider-Man 2,” which grossed more than $775 million worldwide, weren’t addressed in the ruling. According to some estimates, Marvel was entitled to roughly 2.5% of the gross box office revenue and recorded some $10 million in advances for the sequel.

If Sweet’s order stands, Lee also would be entitled to a 10% share of any profits Marvel earned from films including “Blade,” “Hulk” and “Daredevil.” This summer, 20th Century Fox will release “Fantastic Four” in partnership with Marvel.

Marvel shares closed down 82¢, or 4.5%, at $17.41.