Praise be to Allah.
There is no contradiction between the verse and the hadith, assuming that it is saheeh. The scholars have reconciled between them as follows:
Discretion should be observed before achieving one’s goal, then when it is achieved and Allah blesses a person by causing him to attain what he seeks, then he may speak of the blessing and give thanks to Allah for it, so long as there is no fear of anyone envying him.
Al-Minnaawi (may Allah have mercy on him) said:
“Help yourselves to achieve your goals” – and the version narrated by at-Tabaraani says “Help yourselves to meet your needs” – “by being discreet” means: Conceal your goals from people, and seek Allah’s help to achieve them. Then he gave the reason for discretion: “for everyone who is enjoying a blessing is envied” that is, if you disclose to people what you are trying to achieve, they will envy you and put obstacles in your way to prevent you from achieving your goal. The time when you can speak of the blessing, as mentioned in the verse, is after it happens and there is no fear of hasad (envy).
End quote from Fayd al-Qadeer (1/493).
The evidence for it being permissible to conceal blessings for fear of envy is the verse in which Allah, may He be exalted, says (interpretation of the meaning): “He [Ya‘qoob] said, O my son, do not relate your vision to your brothers or they will contrive against you a plan. Indeed Satan, to man, is a manifest enemy” [Yoosuf 12:5].
Ibn Katheer (may Allah have mercy on him) said: The words “O my son, do not relate your vision to your brothers” may be understood as a command to conceal the blessing until it comes to pass and becomes apparent, as it says in the hadith: “Help yourselves to meet your needs by being discreet, for everyone who is blessed is envied.”
End quote from Tafseer Ibn Katheer (4/318).
Some scholars are of the view that what is meant by reporting or speaking of blessings is giving thanks for them and showing their effects. So if Allah blesses a person with wealth, he should give thanks to Allah, may He be exalted, for this blessing, and give more charity and be more generous, so that the poor and needy can seek him out. This is what is meant by speaking of blessings. It does not mean talking about the various types of wealth he has been blessed with, or telling people about what he has. The Messenger of Allah (blessings and peace of Allah be upon him) did not do that, and it is not the action of people of dignity and resolve.
Al-Qaasimi (may Allah have mercy on him) said:
“But as for the favor of your Lord, report [it]” [ad-Duha 93:11] means: give thanks for it and show its effects, so that he can give some of what he has in charity, and he should be keen to give to those in need from it. This is what is meant by the command to report it or speak of it.
This verse draws attention to an important point of etiquette, which is to speak of the blessing and make it apparent, for the purpose of helping others and developing a generous attitude, and to avoid the bad characteristic of stinginess, which is usually based on concealing blessings, presenting oneself as poor and complaining.
Shaykh Muhammad ‘Abduh said: The habit of the misers is to conceal their wealth, so that they will have an excuse for refraining from spending. Hence you will only find them complaining about how little they have. As for those who are generous, by giving charity the demonstrate what Allah has given them out of His bounty, and they openly praise Allah for the blessings that He has bestowed upon them. Hence it is valid to understand speaking of the blessing as a metaphor for spending, feeding the poor and helping the destitute.
The words “But as for the favor of your Lord, report [it]” [ad-Duha 93:11] mean: as you yourself have experienced the pain and suffering of the poor, then be generous in spending on the poor. It does not mean simply mentioning the wealth, for that comes under the heading of boasting and showing off, and the Prophet (blessings and peace of Allah be upon him) was far above such a thing. It is not known that he, when obeying this command, would mention money and wealth; rather what is known is that he used to spend what he had and go to sleep hungry.
It may be said by some that what is meant is the blessing of Prophethood, but the context of the verses indicates that this verse is a counterpart of the verse “And He found you poor and made [you] self-sufficient” [ad-Duha 93:5].
So the blessing refers to being made self-sufficient.
End quote from Mahaasin at-Ta’weel (9/493). See also Tafseer Juz’ ‘Amma by Shaykh Muhammad ‘Abdah (112).
However, speaking of blessings does not require speaking about them in detail; rather it should be in general terms, by saying “Allah has blessed me with health, made me well off and guided me,” and not by describing these blessings in detail.
As-Sa‘di (may Allah have mercy on him) said:
“But as for the favor of your Lord, report [it]” [ad-Duha 93:11]: this includes both spiritual and worldly blessings. In other words, praise Allah for them and speak specifically of them if it serves a purpose, otherwise speak of the blessings of Allah in general terms, for speaking of the blessings of Allah prompts one to give thanks for them and makes the heart love the One Who bestowed the blessings, for people are inclined to love the Bestower of blessings.
End quote from Tafseer as-Sa‘di (p. 928).
And Allah knows best.