My first thought is that the question, on its face, is something of a misstatement. I would say that right and good are self-referential (they are not necessarily synonymous, but they are closely related). I would say that the right thing to do is a good act, and good acts are the right thing to do - they are terms which inform and define one another; as I said, very close to synonymous.
A much more interesting question, however, and I think that this is what supergoober may have intended with his question is "good vs. necessary". Of course, implicit in this question is the concept of the "necessary evil", an idea that I have used in previous arguments/justifications for certain things, but one which, of late, I have come to feel is quite weak and can be used as a justification for almost anything. As a result, I do not believe that the idea of "necessary evil" is a tenable position to defend.
However, there are many necessary acts that are morally neutral, and, in fact, some acts that are "evil" are less evil or even morally neutral given context. In fact, much of morality is not about the actual act, but about the context of the ramifications and of the intent behind the act.
For example, many religions view sex outside of marriage as wrong. In fact, there is a lot, generally, of interest in sexual ethics. The actual sexual act is not the moral concern (even at the heart of the Catholic religious teaching - I am Catholic, by the way - the essence of the teaching is not actually about the sex act), rather the impact it has on the people involved. Sex can be morally good, morally neutral, or morally evil (in my opinion). When it serves to enhance the relationship between two loving individuals, when it deepens the relationship, when it is mutually expressive of love and it brings those two people closer in their relationship, then it is a moral good. When it is simply two consenting individuals meeting for mutual physical gratification of a need or perceived need, it is morally neutral (though I would argue that this situation is extremely rare - people do not come in to sexual encounters with equal power, with well-identified and conveyed intentions, etc.). When it sex is solely for one of the partner's personal gratification with no care to the other person, or when it is done to establish control or power over another, or when it is done to demean another is when it is morally evil.
(Side note - this is not to say that a committed, loving couple cannot engage in behavior that would appear demeaning to others when viewed out of context; rather, if the behavior serves to strengthen the loving relationship, it is appropriate and good)
If an act becomes necessary (for example, if the act is compelled) - it ceases to have moral implications, in effect becoming morally neutral. For example, if I were to tell you that if you don't steal a loaf of bread, I will kill your wife, you would have little option but to steal the bread (a lesser evil than the taking of a life) or somehow stop me by restraining, injuring, or even killing me (again, done in the service of preserving a life).
You may have noted that I remarked that one thing was "less evil" than another. While I do believe that there is an absolute morality (that is, there are things that are unequivocally right or wrong), but that does not preclude gradations. It is entirely possible for things to be more or less right or wrong under this structure. Most people erroneously believe that belief in an absolute morality precludes gradation; it does not. Stating that there is a right answer does not mean that there aren't lesser right answers, better wrong answers, and completely wrong answers.
In a non-moral sense that allows for visualization of this, consider the equation
