Could someone show an example of two spaces X and Y which are not of the same homotopy type, but nevertheless \pi_q(X)=\pi_q(Y) for every q? Is there an example in the CW complex or smooth category?

There are such spaces, for example X = S^2 \times RP^3, Y = S^3 \times RP^2. (These are both smooth and CWcomplexes.) Whitehead's Theorem says that for CWcomplexes, if a map f : X \to Y induces an isomorphism on all homotopy groups then it is a homotopy equivalence. But, as the example above shows, you need the map. Such a map is called a weak homotopy equivalence. (Whitehead's Theorem is not true for spaces wilder than CWcomplexes. The Warsaw circle has all of its homotopy groups trivial but the unique map to a point is not a homotopy equivalence.) 


All of these examples involve a bit of cleverness, so I thought I'd point out a more straightforward way to construct counterexamples. If X is any space, we can build a space X' = K(π_{0}X, 0) × K(π_{1}X, 1) × K(π_{2}X, 2) × ... which has the same homotopy groups as X, but which is usually not weakly equivalent to X. Pretty much any invariant of spaces other than the homotopy groups will distinguish them. For instance, if X = S^{2}, then H_{3}(X) = 0, but X' contains K(π_{3}S^{2}, 3) = K(Z, 3) as a retract, so H_{3}(X') contains H_{3}(K(Z, 3)) = Z as a retract and cannot be 0. Of course, this doesn't produce geometrically nice spaces like smooth manifolds. 


S^{3} x RP^{2} and RP^{3} x S^{2} are both smooth 5manifolds with fundamental group Z/2 and universal cover S^{3} x S^{2}, so their homotopy groups are all the same. On the other hand, only the latter is orientable since RP^{3} is orientable but RP^{2} isn't, so they have different values on H_{5} and therefore can't be homotopy equivalent. (I think this example is in Hatcher somewhere.) 


Along the same lines: you can produce examples involving simply connected finite CWcomplexes, by using S^{1} actions: CP^{m} x S^{2n+1} and S^{2m+1} x CP^{n} have the same homotopy groups, for instance. It's easy to produce examples with arbitrarily high connectivity: take the homotopy fiber X of any nontrivial map K(A,m)>K(B,n+1), with n>m. Then X and Y=K(A,m) x K(B,n) have the same homotopy groups, but are not homotopy equivalent. Here's a new question: for given k, can you find a pair of kconnected finite CWcomplexes which have the same homotopy groups, but aren't homotopy equivalent? 


It's easy to construct myriads of such examples using finite $T_0$ topological spaces. These are equivalent in a natural way to finite posets (check this wikipedia article). With a poset P we may associate an abstract simplicial complex K(P) whose simplices are the chains of P. It turns out that the geometric realization of K(P) and P are weakly homotopy equivalent (there is a continuous map from K(P) to P inducing isomorphisms on homotopy groups). However, these spaces are not homotopy equivalent (unless they are both homotopy equivalent to a discrete space). Moreover, examples of weakly homotopy equivalent finite spaces that are not homotopy equivalent are also easy to give. The following notes by J.P. May are a nice introduction to this topic: http://www.math.uchicago.edu/~may/MISC/FiniteSpaces.pdf , http://www.math.uchicago.edu/~may/MISC/SimpCxes.pdf 

