How to apply Hamming Window and compute FFT?
Three possible issues:


The Discrete Fourier Transform definition that the MATLAB fft uses does not preserve the energy of the vector.  Multiply it by $1/\sqrt{N}$, where $N$ is the FFT size, if you want to keep the energy constant.  The DFT used by the other code might (or might not) have different scaling.
You are computing $10log_{10}$ of the magnitude of the signal, but to compute the power spectral density you should be computing $10log_{10}$ of the magnitude squared - or, alternatively, $20log_{10}$ of the magnitude.
I don't know how the other code got 8607 rows, but if you form windows such that each window contains data in the original vector, you would get 8762 rows by my calculation.  In your use of buffer, you get some windows that are stuffed with 0s at the end.