I spent a pleasant evening chatting with friends.

Literal

Friend [with-と] talk [object-を] do-and enjoyably night [object-を] spent.

楽しく is the adverbial form of 楽しい, modifying 過ごす — 'spent enjoyably.' The te-form 話をして connects two events sequentially: talking led to a pleasant evening. 過ごす ('to spend time') is the standard verb for describing how time was spent.