Let's keep our groups finitely presented for the time being. All spaces in this post are path connected.
Background: By a standard construction (e.g., on p. 365 of Hatcher), there exists a $K(\pi, n)$ for any (Abelian for $n>1$) group $\pi$ and any positive integer $n$. We can then multiply these varying over $n$ to obtain a space with arbitrary homotopy groups (abelian for $n>1$ again). An easier construction shows that we can do the same for homology, at least for any sequence of finitely presented groups, by wedging together a bunch of spheres and adding $n$-cells to give the appropriate torsion.
Now, we can't do this simultaneoulsy in a completely arbitrary fashion: the Hurewicz theorem gives an isomorphism between (the abelianization of) the first nontrivial homotopy group and the homology in the same dimension. But are there any other obstructions to doing this?
Question: Fix $n>0$. Assume I have two sequences of (finitely presented) Abelian groups $G_{n+1}, G_{n+2}, \dots$ and $H_{n+1}, H_{n+2}, \dots$, and in addition a (finitely presented) group $G_n$ and $H_n \cong G_n^{ab}$.
Is there some path-connected space $X$ with $\pi_k(X) \cong G_k$ and $H_k(X) \cong H_k$ for $k\geq n$ and $\pi_k(X) \cong H_k(X) \cong 0$ for $k<n$?
There are relatively easy-to-state obstructions coming from Serre classes. In short, a Serre class of abelian groups is a collection of abelian groups closed under various natural constructions; examples include
Serre proved the following.
This has various corollaries, among the most important being that the homotopy groups of spheres are finitely generated.
More generally, if you know the homotopy groups of your space and they aren't too complicated you can try to analyze the structure of all possible Postnikov towers your space could have. The theory of Postnikov towers tells you that at least in nice cases, and in particular if a space is simply connected, then the only additional data aside from the homotopy groups you need to uniquely determine its homotopy type (and in particular to uniquely determine its homology) is a sequence of cohomology classes called the $k$-invariants of its Postnikov tower.
For example, the next most complicated case after Eilenberg-MacLane spaces is when exactly two of the homotopy groups are nontrivial. If $X$ is a space with $\pi_n$ and $\pi_m$ nontrivial, where $n \ge 2$ and $m \ge n + 1$, then $X$ fits into a fibration sequence ($X$ is a "twisted product") of the form
$$K(\pi_m, m) \to X \to K(\pi_n, n)$$
where $X \to K(\pi_n, n)$ induces an isomorphism on $\pi_n$, and applying the Serre spectral sequence to this fibration puts strong restrictions on the possible homology groups of $X$; in particular if everything is finitely generated then you can bound the ranks of the homology groups of $X$.
But you can say more: isomorphism classes of such fibrations are completely classified by their $k$-invariants, which are cohomology classes in $H^{m+1}(K(\pi_n, n), \pi_m)$, so if you can compute this group you can try to write down all of the possibilities for $X$ and so all of the possibilities for the homology of $X$, or at the very least you can count them. In particular, if this group vanishes then $X \cong K(\pi_n, n) \times K(\pi_m, m)$ and so its homology is uniquely determined.
Example. Suppose $X$ is a space whose only nontrivial homotopy groups are $\pi_2 \cong \mathbb{Z}$ and $\pi_m$, where $m \ge 4$ is even. The classifying space $K(\mathbb{Z}, 2)$ is the infinite complex projective space $\mathbb{CP}^{\infty}$, and in particular has no cohomology in odd dimensions with any coefficients. Hence in this case $H^{m+1}(\mathbb{CP}^{\infty}, \pi_m)$ vanishes and the homology of $X$ is uniquely determined.