It is narrated from Sayyiduna Wathilah bin al-Asqa' (may Allah be pleased with him) that he said: I heard the Messenger of Allah (peace and blessings be upon him) saying: "Allah, the Mighty and Majestic, has said: 'I am with the opinion My servant holds of Me, so let him think of Me whatever he wishes.'"
Abu Bakr bin Abi Shaybah, Ibn Hibban in his Sahih, and al-Hakim recorded it, and al-Hakim declared it sahih; al-Bayhaqi also recorded it. The wording of Ahmad bin Hanbal's narration is: Hayyan Abu al-Nadr relates: I set out to visit Yazid bin al-Aswad in his illness, and I met Sayyiduna Wathilah bin al-Asqa' (may Allah be pleased with him), who also intended to visit him. So we went in to him. When he saw Sayyiduna Wathilah (may Allah be pleased with him), he stretched out his hand and began to beckon to him. So Sayyiduna Wathilah (may Allah be pleased with him) came forward and sat down by him. Then Yazid took both palms of Sayyiduna Wathilah (may Allah be pleased with him) and placed them on his face. Sayyiduna Wathilah (may Allah be pleased with him) asked him: "What is your opinion of Allah?" He replied: "By Allah, my opinion of Allah is very good." At this Sayyiduna Wathilah (may Allah be pleased with him) said: "Then rejoice, for I heard the Messenger of Allah (peace and blessings be upon him) saying: 'Allah, the Mighty and Majestic, has said: I am according to the opinion My servant holds of Me; if he thinks good, it is good for him, and if he thinks evil, it is likewise for him.'"
Muslim recorded this hadith in his Sahih, and other hadith scholars from the narration of Sayyiduna Jabir (may Allah be pleased with him), while Abu Dawud, al-Tirmidhi and Ibn Hibban recorded it from the narration of Sayyiduna Abu Hurayrah (may Allah be pleased with him).