Though a marginal improvement over its predecessor, “The Amazing Spider-Man 2” still calls into question the wisdom of rebooting this Marvel property so soon after the 2002-2007 Sam Raimi trilogy. But since everything in Hollywood is a matter of profit, and in this age of superhero frenzy at the boxoffice it’s entirely predictable that Mark Webb’s sophomore outing starring Peter Parker and his arachnid alter-ego would undoubtedly stir up an army of ticket-buyers here and abroad, questions of quality must have been pretty much beside the point in the decision to green-light a sequel.

In any event, Webb is again fortunate to again have Andrew Garfield as his leading man. He brings a real sense of soulfulness to Parker, a kid on the edge of adulthood still tortured by his abandonment as a child by his parents Richard and Mary (Campbell Scott and Embeth Davidtz), who left him in the care of his Aunt May (Sally Field). Unfortunately, the script by Alex Kurtzman, Roberto Orci, Jeff Pinkner and James Vanderbilt weakens the character by turning him into a smart-ass even in civilian clothes rather than only when he’s wearing his spandex suit. Tobey Maguire’s more subdued, pensive Peter was more on the mark.

Otherwise the script gathers together bits and pieces of the comic mythology and cobbles them into a rather clumsy jumble, inventing a lot of new material in order to tie everything together. When we first see Parker, he’s diverted from reaching his high school graduation on time by the need to foil the theft of an Oscorp truck containing radioactive material by terrorist Aleksei Sytsevich (Paul Giamatti). But he makes the ceremony in time to give a very public onstage smooch to his girlfriend (and class valedictorian) Gwen Stacy (Emma Stone), whom he’s romancing despite his promise to her deceased father (Denis Leary) to stay away lest he put her in danger. That explains why the ghost of Captain Stacy appears periodically to express his displeasure with their relationship—something that eventually causes Peter to break it off. (The graduation sequence, while otherwise pretty lame, at least dispenses early on with the obligatory Stan Lee cameo.)

During his battle with Sytsevich, Spidey has stopped to assist geeky Oscorp drone Max Dillon (Jamie Foxx), who quickly becomes his biggest fan. (This remaking of the Dillon character might remind you of the way Richard Pryor was used—or rather misused—in “Superman III.”) Unfortunately, Max is soon gruesomely affected by a work accident that sends him falling into a tank full of ravenous electric eels; he emerges as the deformed, glowing Electro, who can suck electricity from the Manhattan grid and use it against anybody—including Spider-Man, for whom he unaccountably develops an instant hatred in their first street encounter, believing that the wall-crawler has upstaged him. The intensity of his anger only increases after Spidey has defeated him and he’s being tortured at Oscorp by mad scientist Dr. Kafka (Marton Csokas, whose wacky over-the-top performance suggests Dr. Stangelove squared, a crude caricature that seems to have wandered in from another movie entirely).

Meanwhile Peter’s old childhood friend Harry Osborn (Dane DeHaan) returns from Europe in time to watch his rich but nasty billionaire father Norman (Chris Cooper) die, horribly disfigured—but not before telling the boy that he’s expiring from a genetic disease that will soon carry off Harry too. It turns out that Peter’s father had been engaged in research to harness the recuperative power of spiders to cure the elder Osborn, but the experiment also had other, darker motives that led Richard to flee with his wife. Learning of this, Harry seeks out Spider-Man, the obvious result of Richard’s research, to request a blood sample that might save his life. When Peter, as Spidey, refuses, it infuriates Harry, who’s then ousted from leadership of his father’s company by Norman’s supercilious aide (Colm Feore). He seeks vengeance against all his enemies by freeing Electro not merely to handle Spider-Man but to get him access to Oscorp’s secret store of the liquid that resulted from Richard Parker’s experiments—stuff that he hopes might save him, but instead turns him into the Green Goblin. Spidey thus has to face off against first Electro and then the Goblin, with spunky Gwen insisting on accompanying him with results that fans of the comic will know well but might surprise newcomers.

This is an awful lot of plot for the movie to bear, and the précis doesn’t even address Peter’s unending search for his father’s reason for leaving him behind with May, which ends up in a deserted part of New York’s subway system. Suffice it to say that Spider-Man survives the double danger of Electro and Goblin but suffers another personal loss in the process. Thanks to the inspiration provided by a kid he’d earlier saved, however, he bounces back in time to face off against yet another nemesis—Sytsevich, who’s donned a metallic Transformers-like suit to become Rhino.

It should be obvious that there are too many villains in “The Amazing Spider-Man 2”—doubling or tripling up on them has always been the bane of these movies (see, for example, Raimi’s “Spider-Man 3”). Another reason for complaint is the employment of Electro’s energy-sucking capacity to fashion a blackout of the city (another throwback to “Superman III”), followed by one of those battles that feature a lot of whirling blasts of electricity that reach back to movies like “Return of the Jedi.” There’s too much of a crushingly kid-friendly element to the picture, too, especially in terms of that tyke who never gives up on Spidey, whose abandonment of his secret calling is reminiscent of the plot device used in “Spider-Man 2” anyway.

Why, then, is this picture slightly better than its predecessor? Mostly because it has superior effects. The fights between Spider-Man and the giant Lizard of the first film had a rubbery look to them; the figures were not only obviously CGI creations, but mediocre ones. Even though the shimmering Electro is the sort of thing you’ve seen before, it’s done pretty well, and the final face-off between him and Spidey does in fact strike some sparks, figuratively as well as literally. The same, unfortunately, can’t be said of the succeeding fight with the Goblin, which is staged well enough but is marked by some really awful makeup for DeHaan.

That excellent young actor isn’t treated well by the script in other respects, either. One can glimpse his talent for nuance in some of his early scenes, but as he turns into a driven avenger, every hint of subtlety drains out of him and he’s totally given over to mugging and screaming his lines. By contrast Foxx is embarrassed at the start by the nerdy shtick, but he has a few good scenes stumbling around in a hoodie to cover his now-gruesome face before turning into the fully transformed Electro, when he becomes more special effect with Foxx’s voice than actual actor. Stone proves a more animated presence this time around, and apart from Csokas and Giamatti (who’s really wasted here), the rest of the cast—Field, Scott, Davidtz, Feore, Cooper—acquit themselves well enough.

As the observations about the special effects suggest, this is a first-rate technical package, although some of the 3D-dominated moments are pretty cheesy (those eels lunging straight at you resemble something out of “Piranha 3D”). Otherwise Daniel Mindel’s cinematography is solid. There are points when Pietro Scalia seems to find it difficult to juggle all the plot strands smoothly, but that’s more the fault of the script than the editing; and Hans Zimmer’s score, augmented by work from the so-called Magnificent Six, is mostly fine, though it goes typically bombastic in the action scenes.

In the sea of superhero movies that have flooded the screen in recent years, this “Spider-Man” doesn’t really deserve its titular adjective; but while it doesn’t match the second movie in Raimi’s threesome, it’s slightly better than Webb’s first.