Define, for $a<x \le b$, the function
$$h(x)=\frac{f(x)-f(a)}{x-a}$$ and note that we have
$$h'(x)=\frac{(x-a)f'(x)-(f(x)-f(a))}{(x-a)^2}.$$
Since $f'(a)=0$ we see that $\lim_{x \to a}h(x)=0$, so that on defining $h(a)=0$ we have $h(x)$ continuous on $[a,b]$, and at a max or min of $h(x)$ we have $h'(x)=0$.
Suppose for now there is a point $x=c$ in the open interval $(a,b)$ at which $h(x)$ is max or min; then $h'(c)=0$, which means
$$(c-a)f'(c)-(f(c)-f(a)=0,$$
i.e. $$f'(c)=\frac{f(c)-f(a)}{c-a}.$$
EDIT: Part of the following approach (to ensure some $c \in (a,b)$) was suggested by user1296727 in a comment.
Now $h$ has both a max and a min in $[a,b]$. If both of these were at the same point, then $h$ would be constant, so it's derivative would vanish everywhere. So the max and min are at two different points, and the only bad case would be if the min were at $a$ and the max were at $b$, or vice-versa.
Now if $f(a)=f(b)$ then from $h(a)=0=h(b)$ and Rolle's theorem there is $c \in (a,b)$ with $h'(c)=0$ as desired. Note now that from the assumption $f'(b)=0$ we have
$$h'(b)=-\frac{f(b)-f(a)}{(x-a)^2}.$$
Since we've taken care of $f(a)=f(b)$ there are two cases remaining.
If $f(a)<f(b)$ then $h'(b)<0$ while $h(b)>0$ so that the max of $h$ is not at $a$, and also cannot be at $b$ because $h'(b)<0$. Hence in this case the max of $h$ occurs at some $c \in (a,b).$
If on the other hand $f(a)>f(b)$ then we have $h'(b)>0$ while $h(b)<0$ so that the min of $h$ is not at $a$, and also not at $b$ because $h'(b)>0$. So in this case the min of $h$ occurs at some $c \in (a,b).$
In all three cases of possible ordering between $f(a)$ and $f(b)$ we have the desired $c$ in $(a,b)$ at which $h'(c)=0$, to finish the argument.