Google’s second-quarter earnings badly missed Wall Street expectations, as costs-per-click (CPC), a key advertising metric, continues to show weakness. But despite the worries over mobile ads, JPMorgan believes Google still has a considerable amount of upside from here. In a note defending Google following the report, JPM analyst Doug Anmuth said Google’s big miss is a great opportunity for investors and shares should be bought on weakness.

“Light revenue was largely attributable to self-inflicted policy changes impacting the Google Network and we’re comfortable with the magnitude of increased investment spending given Google’s track record on innovation and many large growth opportunities ahead,” Anmuth wrote in the note.

He rates Google shares Overweight, even though CPCs fell 6% year-over-year, and 2% sequentially. Investors continue to fret over mobile ads, and whether they will ever be as lucrative as desktop ads are. However, Anmuth believes that will eventually correct itself, and mobile will be just as lucrative for Google.

In particular he thinks that mobile and display ads will get stronger in the second half of 2013 and 2014 as Google figures out mobile monetization. Google’s big weapon in the mobile ad arena will be the changes it’s made to Enhanced Campaigns that will force advertisers to buy ads for both mobile and desktop, not just one or the other. After factoring this in with revenues from Google Shopping and Product Listing Ads, Anmuth has set a $1,015 price target on shares.

This comes after Google earned $9.56 per share on $11.1 billion in revenue, excluding traffic acquisition costs (TAC). Analysts were looking for $10.78 per share on $11.33 billion in sales, ex-TAC. Google shares were lower in early Friday trading, off 3.02% to $883.20. In other words, it Anmuth’s analysis is correct, now might be a good time to buy.