IBM kept its spot as the top U.S. patent recipient last year, data issued Thursday showed, while Google raced ahead of Apple in the two rivals’ escalating fight to secure more intellectual property.

The U.S. Patent and Trademark Office granted IBM 6,478 patents in 2012, up nearly 5% from a year ago, according to IFI Claims Patent Services, a research firm in Madison, Conn. IBM ranked No. 1 for the 20th straight year, solidifying the Armonk, N.Y., company’s position as an aggressive producer of new technology in fields ranging from artificial intelligence to data analytics.

Google was the big surprise — even though Apple ramped up its patent activity considerably, it was overtaken by the search giant, which shot up the ladder:

Historical laggard Google showed up on the top 50 list for the first time, ranking No. 21 with 1,151 granted applications. The search giant outpaced Apple, No. 22 on the list, by 15 patents. Apple’s patent count still surged 68% last year. Google was up 170%.

Technology that covers mobile devices accounted for more approved patents than any other subject, according to IFI’s analysis, followed by search and advertising.

A Google spokesman declined to categorize the focus of the company’s research and development activity, though he said the company is “proud of the innovation by our engineers that has let us file a growing number of high-quality patents.”

And while Google’s acquisition of Motorola Mobility bought the company a valuable block of historic patents that are crucial to the mobile industry, it did not earn it a major chunk of new patents in 2012. Motorola Mobility, still measured as an independent company in the 2012 rankings, did not make it to the top 50. It was granted 201 patents last year, IFI told the WSJ’s Fitzgerald.

But the company will need to be careful with those crown jewels of the Motorola Mobility deal: although the FTC’s antitrust investigation into the company was essentially a fizzle, the one place it came down fairly firmly was on patent licensing. The FTC made it clear that so-called standards-essential patents crucial to competition must be licensed on reasonable terms — meaning all those new patents earned in 2012 are even more important parts of Google’s patent war arsenal.