Complete verse :
“They ask thee concerning wine and gambling. Say:
“In them is great sin, and some profit, for men;
but the sin is greater than the profit.”
They ask thee how much they are to spend; Say:
“What is beyond your needs.”
Thus doth Allah Make clear to you His Signs:
In order that ye may consider”
This ayah was revealed when Umar Ibn Khattab prayed to Allah “O Allah! Show us Your judgement regarding alcoholic drinks!”. And then Allah said to prophet Muhammad (pbuh) about matter of gambling and drinking wine. It was explained that benefit of gambling (acquiring money effortlessly) and wine (delight and enjoyment when drink it) are less beneficial than the sin (fighting, cursing, swearing, etc as a result from them). Some people gave up gambling and drinking wine when this ayah was revealed, but some didn’t. Therefore both were then made illicit in QS:5:90-91.
Amr Ibn al-Jamuh asked the Prophet (pbuh) about what should we spend from our wealth. Allah then said to Prophet Muhammad (pbuh) “What is beyond your needs” or surplus from the income.
Tafsir source : Tafsir Al-Jalalayn & Tanwir Al-Miqbas min Tafsir Ibn Abbas
Translations by : Yusuf Ali