Aslamalaikum brother, I was wondering about the islamic principles on how to spend money. For example if someone had a good job and made good money and therefore lived lavishly but still followed the 5 pillars of islam and gave charity, would their religious deeds be deemed hypocritical due to their lifestyle. I feel very guilty when buying 'unnecessary' things when some people struggle to buy necessities and I struggle to understand why Allah created such a rich/poor gap in the world
Alaikumassalam wa rahmatullah,
Scholars like Ibn al-Jawzī recommend viewing your body and its desires and pleasures similar to viewing a steed (a horse or other animal that you need for a journey). You should try to keep the steed in good health and to give it some of the pleasures it requires so that it can serve you effectively.
So we should seek moderation when treating yourselves, neither spoiling ourselves with too much spending, or being cruel to ourselves by denying ourselves all pleasures.
I do not see anything wrong with a rich person occasionally treating themselves with pleasures and luxuries that are denied to others. But ideally this should represent only a small amount of their wealth. Every time you spend your money on a luxury, you can make it rule to spend the same amount on charity. And a person especially eager to please God can choose to spend twice as much on charity as on luxuries, and so on.
Personally if I had a large income I would choose a certain percentage (such as 10%) to give to charity. So if my income with $5000 a month, I would give $500 to charity every month. But if my income was much greater, I would choose a larger percentage, even half, to give to charity every month.
The wealth that God gives us is something entrusted to us by Him. So we should view it in this way and try to always keep in mind that we should use it to please Him.
As for why God created the rich/poor gap, it is because it makes this world an effective testing hall. If there we were all equally wealthy we would have much fewer chances to be patient or generous than the present system. I discuss this in detail in my essay: Why God Allows Evil to Exist, and Why Bad Things Happen to Good People