The isoscalar proton-neutron pairing and isovector pairing, including both isovector proton-neutron pairing and like-particle pairing, are treated in a formalism which conserves exactly the particle number and the isospin. The formalism is designed for self-conjugate (N=Z) systems of nucleons moving in axially deformed mean fields and interacting through the most general isovector and isoscalar pairing interactions. The ground state of these systems is described by a superposition of two types of condensates, i.e., condensates of isovector quartets, built by two isovector pairs coupled to the total isospin T=0, and condensates of isoscalar proton-neutron pairs. The comparison with the exact solutions of realistic isovector-isoscalar pairing Hamiltonians shows that this ansatz for the ground state is able to describe with high precision the pairing correlation energies. It is also shown that, at variance with the majority of Hartree-Fock-Bogoliubov calculations, in the present formalism the isovector and isoscalar pairing correlations coexist for any pairing interactions. The competition between the isovector and isoscalar proton-neutron pairing correlations is studied for N=Z nuclei with the valence nucleons moving in the sd and pf shells and in the major shell above 100 Sn. We find that in these nuclei the isovector pairing prevail over the isoscalar pairing, especially for heavier nuclei.However, the isoscalar proton-neutron correlations are significant in all nuclei and they always coexist with the isovector pairing correlations.