SAN FRANCISCO — Google Inc. will be able to continue posting content from The Associated Press under a new licensing deal the two companies announced Monday after months of sometimes thorny negotiations.

The AP said in a statement that the two companies also will work together in ways to improve discovery and distribution of news.

Financial terms and the duration of the contract were not disclosed.

"We think this is a good deal for both sides," said Jane Seagrave, AP's chief revenue officer. "We have had a long relationship with Google and are pleased we were able to work out our differences."

Google, the Internet's most profitable company, began to pay for AP's content in 2006 after the not-for-profit news agency threatened to sue. That contract expired in January but was extended while the negotiations on a new deal progressed. The talks got so thorny that at one point, Google stopped hosting AP content.

Even after the 2006 agreement, Google and AP still had an uneasy relationship.

AP executives have said they still believed that the news cooperative wasn't being adequately compensated for its material, partly because Google's search engine pointed to websites that the AP said had pirated its content.

Google, in turn, insisted that it was simply fulfilling its mission to help its users find pertinent information.

In a possibly conciliatory sign, Google said it intended to help the AP find more ways to make money online while striving to create a better experience for its own users. Neither company provided further details on their plans for cooperation.

Google also has signed contracts with Agence France-Presse, UK Press Association, Canadian Press and other outlets.

Under these licensing agreements, Google publishes entire stories from the AP and other outlets in the news section of its website.

That's a departure from Google's usual practice of just showing snippets from stories posted on thousands of other websites. Google maintains those excerpts qualify as "fair use" under U.S. copyright law, exempting the company from having to pay any licensing fees to most Web publishers. Some media executives, such as News Corp. Rupert Murdoch, have blasted Google for the practice, arguing that Google is profiting from the work of others. Google argues it is helping newspapers by driving more traffic to its website.

Unlike newspapers and broadcasters, the AP doesn't try to draw traffic to stories on its own website. Rather, the AP licenses its content to other media, which sell their own advertising in print, on the airwaves and on the Internet.

The Google deal is part of AP's effort to bring in more revenue from the Web to help offset a drop in revenue from newspapers and broadcasters that have been hard hit by an advertising slump. As part of that process, AP renewed its licensing agreement with Yahoo Inc. earlier this year and is trying to strike a new deal with Microsoft Corp.

The 164-year-old AP gets about 40 percent of its revenue from U.S. newspapers and broadcasters. The AP is preparing for that ratio to fall as more readership and advertising migrate to the Internet.

The transition has been bumpy so far. The AP's revenue declined nearly 10 percent last year to $676 million, and management anticipated another drop this year as it cuts fees for newspapers and broadcasters. The financial slump prompted the AP to lay off about 90 employees from its news staff late last year, the biggest cutback at the cooperatives in decades.

Google, meanwhile, has been thriving, even during the worst U.S. recession since World War II. The company earned $6.5 billion on revenue of nearly $24 billion last year. Its net income is up by more than 30 percent so far this year, compared with last year.