Without looking up the MLB rule, here is the Fed Rule. Look pretty close on first glance:
ART. 7 . . . In order for a pitcher to be credited with a save, he shall meet all
three of the following criteria:
a. he is the last pitcher in a game won by his team; and
b. he is not the winning pitcher; and
c. he meets at least one of the following:
1. he enters the game with a lead of not more than three runs and pitches at least one inning; or
2. he enters the game regardless of the count on the batter with the potential tying run either on base, at bat or on deck; or
3. he pitches effectively for at least three innings.
4. A starting pitcher who is replaced and then re-enters as pitcher can be credited with a win but not a save.