5. Find all positive integer solutions to the indeterminate equation $\left(a^{2}-b\right)\left(a+b^{2}\right)=(a+b)^{2}$.

Translate the text above into English, please keep the original text's line breaks and format, and output the translation result directly.
5. Clearly, $(a, b)=(2,1)$ is a solution to the original equation. Now assume $b>1$, and let $(a, b)=d$, then $a=a_{1} d, b=b_{1} d$, where $\left(a_{1}, b_{1}\right)=1$. Thus, the original equation can be rewritten as $a_{1}\left[a_{1} b_{1}^{2} d^{2}+a_{1}\left(d a_{1}-1\right)-3 b_{1}\right]=b_{1}^{2}\left(d b_{1}+1\right)$.
Since $b_{1}$ divides the right side of the above equation, it must also divide the left side, hence $b_{1} \mid\left(d b_{1}-1\right)$, which means $b_{1} \mid(a-1)$. Since $a>1$, we have $a_{1} \geqslant b_{1}$. Noting that $b>1$, we have $(a+b)^{2}>\left(a^{2}-b\right)(a+b) \Rightarrow a+b>a^{2}-b$, i.e., $2 b>a(a-1)$, so $2>\frac{a(a-1)}{b}=a_{1} \cdot \frac{a-1}{b_{1}} \geqslant a_{1}$. Therefore, $a_{1}=1$, and $a-1=b_{1}$, thus $b=b_{1} d=a(a-1)$. Substituting into the original equation, we get $a+a^{2}(a-1)^{2}=a^{3}$. The left side of the above equation should be divisible by $a^{2}$, i.e., $a^{2} \mid a$, thus $a=1$, which is impossible. Therefore, the equation has only the positive integer solution $(a, b)=(2,1)$.