PIC:What is the difference of SPI module of PIC18F4685 and PIC18F66K22?
The answer is probably partially yes and partially no.

Any high-level functions in the library that don't call any registers directly (perhaps a function that queues up multiple character bytes for transmission) will definitely still work. However, functions that have direct calls to registers may or may not work. Different families of PICs may use different register names for the same purpose.

That said, Microchip is generally very consistent with their register naming across their 8-bit product line. More likely than not, all of the register names will be the same and the common library will work. A possible exception is if one chip has a single SPI module and the other has multiple. For example, the SSPCON register on the single chip will correspond to SSPxCON (where x is the module number) on the multiple chip.

To answer this question conclusively, you have to read the datasheet. The SPI module information will be included in the section called "Master Synchronous Serial Port (MSSP) Module". Go through both datasheets and compare the register names and the bit settings. If they're the same, you're golden. If there are any differences, you'll have to adjust the library functions accordingly.