In D&D? Absolutely necessary, but not sufficient.
A neutral character might fight against evil out of self-interest, because evil threatens their community, or because evil threatens principles such as freedom or social order which they hold dear: but this does not make them good.
Good characters in D&D not only oppose evil, they actively seek to make the world a better place otherwise. Charity, for instance, doesn't really oppose evil directly, but it makes the world a better place. Going on a dangerous journey to find a rare medicine to save someone's life doesn't really oppose evil, but it's a generous and kind act of self-sacrifice.
That said, I don't think a good character must necessarily be out adventuring against evil. All the examples of good characters like nuns and hospital workers can oppose (fight) evil as they come across it - a nun might offer counselling to someone who is tempted by evil, and a hospital worker might come across evidence that her patients are being deliberately exposed to disease and try to discover who the villain is.