Farkas, Kra and Kopeliovich (Commun. Anal. Geom. 4(2):207-259, 1996) showed that the quotients F(1) and F(2) of modified theta functions generate the function field K(X(p)) of the modular curve X(p) for a principal congruence subgroup Gamma(p) with prime p >= 7. For such primes p we first find affine models of X(p) over Q represented by Phi(p) (X,Y) = 0, from which we are able to obtain the algebraic relations Psi(p) (X,Y) = 0 of F(1) and F(2) presented by Farkas et al. As its application we construct the ray class field K((p)) modulo p over an imaginary quadratic field K and then explicitly calculate its class polynomial by using the Shimura reciprocity law.