The retailer's total UK sales rose 1% on a reported basis and 3.2% on an underlying basis. Group sales rose 2.3% on a reported basis.
Press reports over the past few days had painted a gloomy picture of today's trading update, with analysts expecting general merchandise to have fallen by 6%.
In the event, general merchandise fell 3.9% on a like-for-like basis, while M&S chief executive Mark Bolland claimed the company grew market share in the category from 11.3% to 11.6%.
Food sales grew 3.4% on a like-for-like basis, with market share up from 3.7% to 3.8%.
Bolland partly credited advertising for the performance. He said: "Strong products backed by great advertising meant we outperformed the market and grew share in both food and clothing."
However, the trading update was sober about the future, warning that trading conditions would be "increasingly challenging due to pressure on consumers' disposable incomes and higher commodity prices.
"As a result, we are cautious about the outlook. Our focus will be on remaining competitive, and offering our customers great value and quality at a time when they will be managing their budgets carefully."
Operating costs were expected to increase around 5% as a result of increased depreciation, space growth and inflation, as well as investment in growth initiatives.
M&S broke its spring clothing ad campaign on 23 March, and then last week announced it was returning to France after nine years, with a Paris store, an online operation and plans to open Simply Food stores.