Cramer advises investors to buy Amazon on any weakness, saying it's among the companies for the ages

Blue Origin and Amazon founder Jeff Bezos.
Mandel Ngan | AFP | Getty Images

CNBC's Jim Cramer said Friday that any weakness in Amazon shares should be viewed as a buying opportunity.

"Even though Amazon is up a great deal, you will get a chance to buy it," the "Mad Money" host said.

He predicted that Amazon, which traded up nearly 2.4% early Friday, could come down later in the day, asApple did on Thursday when it opened up 2% after blowout quarterly results but closed basically flat.

By Friday afternoon, Amazon was up less than 1%. Amazon shares have soared nearly 15% in a month.

"They will be down at one point and you can go buy them. And you should buy them," Cramer said.

Apple, Google-parent Alphabet, and Facebook, which hit an all-time high Thursday, have all had similarly strong gains in the past month after some rough patches earlier this year.

"These companies are for the ages. It's kind of like we've got a major league and we've got a minor league. And the major league there aren't that many teams in it," Cramer said Friday on "Squawk on the Street."