My confusion is in reference to the solution of this problem, whose problem statement and its solution I restate here:
Problem:
Two blocks of masses $m_1$ and $m_2$ are placed on a rough horizontal surface (coefficient of friction $\mu$), connected by a light spring. Find the minimum constant force that has to be applied on the block with mass $m_1$ so that the other block just begins to slide.
Solution:
For second block $$μm_2g=kx.$$ For first block $$F\cdot x−\frac 12 kx^2−μm_1gx=\frac 12 m_1v^2.$$ Set $v=0,$ to get $$F=\frac 12 kx+μm_1g=\boxed {μg\left(m_1+\frac {m_2}2\right)}.$$
Here $k$ is the spring constant, $\mu$ is the coefficient of friction, $x$ is the change in length of spring and $F$ is the minimum external force applied on mass $m_1$.
Now, my confusion: Why can't this problem be solved using only Newton's Laws? Why is it so necessary to use the work-energy theorem here? Is it because of friction?
EDIT: My approach was this:
For mass $m_1$, $$F-f_1 = F_s, \qquad (1)$$ where $f_1$ is the frictional force on $m_1$, and $F_s$ is the spring force.
Now, we also have $$f_2 = \mu m_2 g = F_s, \qquad (2)$$ so combining $(1)$ and $(2)$ gives us $$ F = \mu g(m_1 + m_2).$$