Celebrated worthily in faith, the sacraments confer the grace that they signify. They are efficacious because in them Christ himself is at work: it is he who baptizes, he who acts in his sacraments in order to communicate the grace that each sacrament signifies. the Father always hears the prayer of his Son’s Church which, in the epiclesis of each sacrament, expresses her faith in the power of the Spirit. As fire transforms into itself everything it touches, so the Holy Spirit transforms into the divine life whatever is subjected to his power.
This is the meaning of the Church’s affirmation that the sacraments act ex opere operato (literally: “by the very fact of the action’s being performed”), i.e., by virtue of the saving work of Christ, accomplished once for all. It follows that “the sacrament is not wrought by the righteousness of either the celebrant or the recipient, but by the power of God.” From the moment that a sacrament is celebrated in accordance with the intention of the Church, the power of Christ and his Spirit acts in and through it, independently of the personal holiness of the minister. Nevertheless, the fruits of the sacraments also depend on the disposition of the one who receives them.
The Church affirms that for believers the sacraments of the New Covenant are necessary for salvation. “Sacramental grace” is the grace of the Holy Spirit, given by Christ and proper to each sacrament. the Spirit heals and transforms those who receive him by conforming them to the Son of God. the fruit of the sacramental life is that the Spirit of adoption makes the faithful partakers in the divine nature by uniting them in a living union with the only Son, the Savior.
From the Catechism of the Catholic Church 1127-1129