The trick is to write the $j$-invariant function in terms of Eisenstein series, whose $q$-expansions have a simple expression. See Silverman's "Advanced Topics in the Arithmetic of Elliptic Curves", Chapter 1, Section 7, and in particular, Proposition 7.4 and Remark 7.4.1.