[A sacrament] is a sensible thing that from the stable institution of Christ has a power for holiness, or for effecting and consequently signifying justifying grace....
For the essence of a sacrament is needed three things: (1) that it be a stable sign; (2) that it signify true holiness; (3) that it have its effect by the deed done [ex opere operato], that is, its use and application, by its own efficacy, not by the doer's doing [ex opere operantis], or by the act or disposition of the minister, or of the one who partakes -- which, although needed for the effect of the sacrament, is needed not as a cause but as a necessary condition [sine qua non].
[St. Alphonsus Liguori, Theologia Moralis, 6.1.1. My (rough) translation.]
ADDED LATER: This is actually an error on my part; the Theologia Moralis is structured as a commentary on another text, and this is from that text rather than St. Alphonsus's commentary. St. Alphonsus doesn't deny any of the above, but holds that a better definition is
a sensible, holy, stable sign of interior grace, instituted by Christ for our sanctification.