June 3 (Reuters) - Nvidia led global companies in market cap gains in May, buoyed by a stunning rally as its bumper revenue forecast reinforced investor confidence in the AI-driven surge in chip demand.

Nvidia's market cap soared to $2.69 trillion at the end of May, marking a nearly 25% increase during the month, as the announcement of its stock split further boosted investor enthusiasm.

Microsoft maintained its position as the leading global company by market cap, rising 6.6% to $3.08 trillion in May, with shares touching record highs driven by expectations that AI will significantly boost profit growth for Microsoft and its major competitors.

Those expectations were further bolstered as the company introduced a new category of personal computers with AI features, called 'Copilot+' PCs, capable of handling more artificial intelligence tasks without relying on cloud data centers.

Apple remained the second-largest company by market cap, surging 12.9% to $2.94 trillion at the end of May, fueled by AI optimism, and increased smartphone shipments to China. Brokerage BofA Global Research noted that artificial intelligence is driving a shift from smartphones to "IntelliPhones" — AI-powered smartphones — and projected that Apple would benefit from a multi-year upgrade cycle driven by AI.

Walmart Inc. experienced significant growth, with its market cap rising 10.8% to $530 billion at the end of last month, as the company reported better-than-expected quarterly results and raised its full-year forecast, anticipating that easing inflation will boost sales of groceries and non-essential merchandise such as clothing and electronics.

Meanwhile, Tesla's market cap dropped nearly 3% to $567.9 billion, affected by a decline in its sales in Europe, slowing growth in electric vehicle demand, and tough competition impacting the demand for Tesla's vehicles.

(Reporting By Patturaja Murugaboopathy and Gaurav Dogra in Bengaluru Editing by Christina Fincher)