Here is J.I. Packer’s answer to that question:
A good deed is done,
1. According to the right standard, that is God’s revealed will or moral law.
2. From the right motive, that is love to God and others.
3. With the right purpose, that is pleasing and glorifying God, honoring Christ, advancing his kingdom and benefiting one’s neighbor.
(Concise Theology, p. 175)