Elon Musk says this crucial skill is what made Steve Jobs and Bill Gates successful 

Bill Gates and Steve Jobs
Getty Images: Gijsbert Hanekroot/Redferns | Tom Munnecke/Hulton Archive

Despite being rivals at various points in their careers, Apple co-founder Steve Jobs and Microsoft co-founder Bill Gates shared many commonalities.

“They’re obviously very driven and they’re very talented,” says SpaceX and Tesla founder Elon Musk in an interview with Autobild.tv.

Yet what really helped them build such successful companies, says Musk, was their ability to attract top talent and earn employee loyalty.

“The ability to attract and motivate great people is critical to the success of a company, because a company is just a group of people that are assembled to create a product or service,” Musk explains, noting that people sometimes forget this “elementary truth.”

Top SpaceX HR exec: Here’s what it takes to score a job at Elon Musk's company
Top SpaceX HR exec: Here’s what it takes to score a job at Elon Musk's company

“If you’re able to get great people to join the company and work together towards a common goal,” he says, “then you will end up with a great product.” Musk adds that a great product attracts buyers, and the more buyers you have, the more successful your company will be.

As simple as this concept may seem, it’s still challenging to find and hire top talent, which is why more companies are employing various tactics beyond standard compensation to attract new hires. Over the years, these incentives have become increasingly extravagant, with perks like pet-friendly offices and catered lunches becoming more common, particularly in the tech sector where there’s already a .

At their Redmond, Washington, campus, Microsoft employees have access to an organic spa and receive benefits like pet insurance and a free shuttle to and from work. Meanwhile, Apple employees receive discounts on company products and have access to an onsite wellness center at their Cupertino, California, headquarters.

As indulgent as these benefits may seem, the results speak for themselves. Both Microsoft and Apple consistently where job seekers want to work.

However, companies must provide more than free perks in order to engage and retain top performers. According to organizational experts, employees who feel like they’re contributing toward a shared vision for the company are much more productive and driven than their counterparts.

During Microsoft's early years, for example, all employees were awarded stock options, which created “Microsoft millionaires” when the company went public in 1986. (The company has since eliminated this program.)

Bill Gates: This is my biggest weakness
Bill Gates: This is my biggest weakness

At Apple, Jobs included his employees in the decision-making process, says Willie Pietersen, a management professor at Columbia Business School and author of "Strategic Learning: How to Be Smarter Than Your Competition and Turn Key Insights into Competitive Advantage.”

The late founder would create different teams to work on projects that had breakthrough potential. When they , he listened to all of their ideas before picking the strongest ones and shelving the others.

Although Jobs could be a harsh leader at times, Pietersen tells CNBC Make It, his management strategy was based on creating the most innovative products, which galvanized his employees and won their support.

Musk uses his own unique strategy to and make them feel like they’re part of a larger team at SpaceX. The billionaire entrepreneur requires that senior executives lead their employees through “selflessness.”

“We want our leaders to find ways of motivating and inspiring their teams, reduce the noise in their work and help remove blockers," Musk tells Glassdoor. "If you are a manager or leading at any level at SpaceX, we stress that your team is not there to serve you. You are there to serve your team and help them do the best possible job for the company."

Like this story? Subscribe to CNBC Make It on YouTube!

Don't miss: Mark Cuban says this is the No. 1 reason people fail in business

Elon Musk, Albert Einstein and Steve Jobs all have these traits in common
Elon Musk, Albert Einstein and Steve Jobs all have these traits in common