How/ Why is spring compression maximum when the two blocks have equal velocities? 
Consider a block of mass $m_1$ attached to a spring. It's advancing
  with a slower velocity $v_1$ as compared to that of an approaching
  block of mass $m_2$'s velocity $v_2$ on the friction-less surface. Obviously, the two blocks
  will collide.

Now, I have read at several places that the spring compression will be maximum when the two blocks have equal velocities. But I couldn't understand that. It's somewhat counter-intuitive to me because first block is accelerating and the one behind is decelerating so how does that eventually lead  to maximum compression in the spring? 
Research effort: I asked a friend on the chat room but his explanation was unsatisfactory. I searched for youtube experiments on this (they help immensely in developing concepts intuitively) but couldn't find any. My books too explain this theoretically without any diagrams. 
Please supplement your answer with diagrams/ mathematical proof to explain this concept (and other related concepts like maximum elongation ,if possible). 
 A: Let $m_1,m_2$ have velocities $v_1,v_2$, where $v_1<v_2$ and $m_1$ is initially ahead of $m_2$.
$m_2$ has a spring attached to its front (in direction of motion).
Once $m_2$ catches up with $m_1$, the spring will be compressed between the two masses, and will (in an effort to return to its initial state) exert a force on both $m_1$ and $m_2$.
This force will cause $m_1$ to accelerate, and $m_2$ to decelerate.

Prior to the closest approach of the two masses, $v_1<v_2$. We know this because (given that the masses are going to get closer), $m_2$ must still be approaching $m_1$.
Following the closest approach of the two masses, $v_1>v_2$. We know this because, given that the masses are no longer getting closer together, and they are still accelerating and decelerating, respectively, $m_2$ must be receding from $m_1$.
Given that we know what is happening on either side of the closest approach of the masses, and we know that the velocities of the masses must change without instantaneous shift (cannot skip past the point at which their velocities are equal), the only logical conclusion is that the velocities of the two masses are equal at the closest approach.
A: Although it should be obvious, and physical explanations as given in other answers are always much better,  you can verify it by doing simple calculations. Let: 


*

*displacement of $m_1$ be $\vec{x_1}$ 

*displacement of $m_2$ be $\vec{x_2}$


Now, the compression/elongation in spring will be $X=|\vec{x_2} - \vec{x_1}|$.
Extrema occurs when $\frac{dX}{dt} =0$
$$\frac{dX}{dt} =\dfrac{d}{dt}\vec{x_2}-\dfrac{d}{dt}\vec{x_1} =0$$
or $\vec{v_1} = \vec{v_2}$
As explained in other answers, this value of extension $X$ is achievable, as the spring is exerting equal force on each body but in opposite direction (always)
A: When the spring can't be compressed any more, they have to stop relative to each other.
Take the view of the center of mass frame, in which only differential velocities remain. Only changes in the distance between the blocks affect the spring (and vice versa).
A: Imagine that the spring is attached to observer $A$.
An object is thrown at observer $A$.
The object hits observer $A$.   
When will observer $A$ observe that the compression of the spring is greatest?
It will be when the object is not moving relative to observer $A$.
(If the object is moving towards observer $A$ the spring is being compressed more and if the object is moving away from observer $A$ the spring is being extended more.)
This means that any other observer who observes the object hitting observer $A$ will note that maximum compression occurs when the object and observer $A$ are moving at the same velocity relative to observer $B$. 
