This is an invaluable tool in complex analysis, and is used in many situations (such as de Moivre's Theorem). Suppose we have an equation

a + ib = c + id
where a, b, c and d are real expressions and i is the square root of -1. Then, by equating real and imaginary parts, we obtain
a = c and b = d.
The justification for this statement comes from considering the expressions a + ib and c + id as points in the Argand Plane.
     Im
     |
     |  x (a,b)
     |
     | x (c,d)
-----+-----------Re
     |

Now, in order for two points to be the same in the place, their horizontal displacements must be the same (so a=c) and their vertical displacements must be the same (so b=d).