Disney is to buy Marvel Entertainment, the comic book company whose cast of characters includes Spider-Man, the X-Men, the Incredible Hulk, Iron Man and 5,000 more, in a deal worth $4bn (£2.5bn).

The takeover, announced yesterday, is designed to bring more testosterone to Disney, which has enjoyed more recent success with characters and films appealing to girls, such as High School Musical and Hannah Montana. In-house Disney franchises appealing to boys are fewer and further between.

"We would love to attract more boys, and Marvel skews more in the boys' direction, although there is universal appeal to many of its characters," said Bob Iger, Disney chief executive. "Marvel's is a treasure trove of characters and stories, and this gives us an opportunity to mine characters that are well known and characters that are not well known."

Marvel traces its history back to the publication of some of the first comic books at the end of the Great Depression, and has prospered by using its characters far beyond their original home inside comics. Licensing deals have spawned toys, games, television series and – most lucratively – movies. Hollywood studios have reached deep into the comic book library to find characters that can be turned into movie franchises. Spider-Man, licensed to Sony Pictures, grossed $2.5bn over three films, and a fourth is in the works. Last year, Marvel hawked out its relatively obscure Iron Man and turned in one of the highest-grossing opening weekends of all time for a new movie franchise. Thor and the first Avenger movie are slated for release in 2011.

Disney is tied into Marvel's existing Hollywood character licensing deals for the time being, but said it would start rooting through the toy box for new ideas immediately.

Reflecting the links between comic book culture and Hollywood, the annual Comic Con International convention in San Diego has expanded into a giant media event attended by more than 125,000 people, studded with celebrity appearances and featuring the launch of a vast range of new books, films and toys and television franchises. Disney aims to muscle in with its own version of the event, called D23 Expo, running next month for the first time.

Disney is paying around $50-a-share for Marvel, made up of $30 in cash and the rest in stock, a 29 per cent premium to the Marvel share price last week. Its shares rose 25 per cent on the news, but fell back slightly in the afternoon, while Disney fell 3.5 per cent in afternoon trading.

Advisers to Disney first approached Marvel a few months ago, and "getting to know you" meetings between Mr Iger and Marvel's chief executive, Ike Perlmutter, developed into full-blown merger talks.

"Disney is the perfect home for Marvel's fantastic library of characters, given its proven ability to expand content creation and licensing businesses," said Mr Perlmutter. "This is an opportunity for Marvel to build upon its vibrant brand and character properties by accessing Disney's global organisation and infrastructure."

This month Marvel reported second-quarter revenues of $116.3m and a profit of $29m. In its most recent quarter, Disney had sales of $8.6bn.

Investors and analysts hailed the acquisition as a good fit for Disney, albeit an expensive one. The deal also signals a return of confidence to the media industry, which has been nervously hoarding cash since the credit crisis began.

"This helps give Disney more important exposure to the young male demographic that they have lost some ground with recently," said David Joyce, an analyst with Miller Tabak.

Disney's last major acquisition was the $7.4bn deal in 2006 to buy Pixar, the animation studios responsible for Toy Story and Monsters, Inc. Pixar and Marvel will collaborate on future ideas, Mr Iger said, and "sparks will fly".