Tuesday wasn't a great day on Wall Street, with most major market benchmarks giving up ground. But that wasn't the case for the Nasdaq Composite (NASDAQINDEX:^IXIC), which was higher by about 0.3% and finished at 9,954. It had briefly traded above the 10,000 mark earlier in the day. The Nasdaq 100 index was up by nearly two-thirds of a percent and edged above 10,000 before falling back at the close.

Smaller companies have made a lot of headlines lately, but the biggest tech companies in the Nasdaq played key roles in driving the entire market higher. Apple (NASDAQ:AAPL) and Amazon.com (NASDAQ:AMZN) were both up between 3% and 4% on the day, and both stocks set new all-time record highs as their respective businesses stay red-hot.

Apple to make chips in-house

Apple stock was up more than 3% as investors assessed the iPhone maker's latest move to integrate more of its operations under its own roof. Apple is looking at building its own semiconductor processor chips to go into its Mac computer line, cutting out processor maker Intel (NASDAQ:INTC) in the process.

Apple Store as seen from outside, with a palm tree next to the entrance.

Image source: Apple.

Apple has learned a lot from its experience in dealing with its supply chain, especially given disruptions related to the coronavirus pandemic. The benefits of having more key components manufactured in-house are greater than ever when you can't necessarily rely on partners to be able to deliver during tough times. Moreover, avoiding the markups that providers like Intel charge on chips can be a big boost to the bottom line, as one stock analyst estimates that Apple could see its gross margin on Macs soar by five full percentage points.

In addition, Apple has seen the pandemic boost its overall strategy of emphasizing services as a larger part of its business. Sales from Apple's App Store have risen dramatically during the first part of the current quarter, and that growth appears to be accelerating despite the fact that more people are starting to return to work after having followed stay-at-home orders over the past few months.

With today's gains, Apple's market capitalization was right around $1.5 trillion. That leaves a lot of gains left to come before crossing the $2 trillion line, but many are choosing the electronic device giant as the natural pick to reach that milestone first.

Amazing Amazon

Amazon, however, isn't going to give up without a fight. The stock posted a 3% rise of its own, and although that leaves Amazon's market cap at "just" $1.3 trillion, some see the e-commerce and cloud-services player as having the better growth prospects.

At least a couple of analysts see Amazon climbing closer to the $2 trillion mark in short order. B of A Merrill Lynch and Wells Fargo Securities both raised their price targets on Amazon stock to $3,000 per share, which would add another $200 billion or so to the online marketplace's market cap. B of A points to the current quarter's boom in online shopping as a unique tailwind for outstanding performance, with considerably better financial results than most currently anticipate when Amazon reports its second-quarter numbers. Wells sees the forward momentum continuing, and even when people return to work and school, the company will be free to pursue other opportunities.

Amazon has plenty of other growth initiatives, ranging from its Amazon Web Services cloud-computing unit to massive spending on improving its shipping and logistics infrastructure. By bringing more key functions in-house, the Seattle-based giant hopes to stop relying on third parties and keep as much of its growth for itself.

Keep your eyes open

It'll be interesting to see where Apple and Amazon go from here. For now, though, everyone can just sit back and enjoy the big gains they've already given their shareholders.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.