Internet stocks had a strong 2017 marked by prominent margin expansion and stock performance. The sector rallied 27% last year, easily topping both the S&P 500's 19% increase and the Russell 200's 13% increase.

Given that outperformance, a large portion of Wall Street has called for growth deceleration in the internet space in line with historical averages. Goldman Sachs, however, disagreed.

"With e-commerce growth accelerating, advertising dollars continuing to shift online and valuations near 5-year historic averages, despite recent outperformance, we expect upward estimate revisions and related multiple expansion will drive continued outperformance in internet," Goldman analysts wrote in a Jan. 19 note.

The internet sector is already up 4% year to date in the dozen trading days so far in 2018.

Goldman said that on a risk/reward basis large-cap names are "attractive given their disproportionate share gains." Amazon.com Inc. (AMZN) - Get Report , Alphabet Inc. (GOOGL) - Get Report and PayPal Holdings Inc. (PYPL) - Get Report are on Goldman's conviction buy list, and Facebook Inc. (FB) - Get Report and Netflix Inc. (NFLX) - Get Report stocks are buy-rated. FANG has led internet outperformance, up 49% on average in 2017, and PayPal has rallied 87%.

Analysts added that there are "idiosyncratic opportunities" in small- and mid-cap names, including their buy-rated GrubHub Inc. (GRUB) - Get Report , Pandora Media Inc. (P) , Twitter Inc. (TWTR) - Get Report , ANGI Homeservices Inc. (ANGI) - Get Report and Zillow Group Inc. (ZG) - Get Report .

Also of importance is accelerating e-commerce growth, which increased 15% in the fourth quarter of 2017 from a year earlier. Goldman forecasts sustained growth, with e-commerce share gains up 147 basis points in 2018 vs. a gain of 134 basis points in 2017. That's especially good news for Amazon, eBay Inc. (EBAY) - Get Report , GrubHub and PayPal.

Growth, leverage, innovation and competition are Goldman's main investment framework considerations. For growth, analysts like Snap Inc. (SNAP) - Get Report , ANGI Homeservices, Facebook, GrubHub, Redfin Corp. (RDFN) - Get Report , CarGurus Inc. (CARG) - Get Report and Netflix, which are all set to grow sales more than 30% over the next three years.

For leverage, look to Pandora, InterActiveCorp (IAC) - Get Report and Shutterfly Inc. (SFLY) - Get Report , which all have incremental margins above 50%. Innovation leaders are those with high product development expenses over the past 12 months -- Amazon, Google, Facebook, Twitter, Redfin and Zillow Group.

As for competitive advantage, the best picks are Amazon, Google, Facebook, Netflix and PayPal.

But Goldman analysts noted that investors are sure to wonder when the multiple years of outperformance will come to an end. The risks to consider are regulation surrounding data, privacy and competition, and antitrust issues, which could both impact companies' abilities to grow.

Alphabet and Facebook are holdings in Jim Cramer's Action Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells the stocks? Learn more now.

More of What's Trending on TheStreet: