<?xml version="1.0"?>
<ownershipDocument>

    <schemaVersion>X0508</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2024-07-01</periodOfReport>

    <issuer>
        <issuerCik>0001056943</issuerCik>
        <issuerName>PEOPLES FINANCIAL SERVICES CORP.</issuerName>
        <issuerTradingSymbol>PFIS</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001491834</rptOwnerCik>
            <rptOwnerName>BONE JAMES M JR</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>C/O PEOPLES SECURITY BANK &amp; TRUST CO.</rptOwnerStreet1>
            <rptOwnerStreet2>150 N. WASHINGTON AVE</rptOwnerStreet2>
            <rptOwnerCity>SCRANTON</rptOwnerCity>
            <rptOwnerState>PA</rptOwnerState>
            <rptOwnerZipCode>18503</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isOfficer>1</isOfficer>
            <officerTitle>EVP, Chief Operations Officer</officerTitle>
        </reportingOwnerRelationship>
    </reportingOwner>

    <aff10b5One>0</aff10b5One>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>COMMON STOCK</value>
            </securityTitle>
            <transactionDate>
                <value>2024-07-01</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>A</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>10576</value>
                </transactionShares>
                <transactionPricePerShare>
                    <footnoteId id="F1"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>A</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>10576</value>
                    <footnoteId id="F2"/>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>COMMON STOCK</value>
            </securityTitle>
            <transactionDate>
                <value>2024-07-01</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>A</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>145</value>
                </transactionShares>
                <transactionPricePerShare>
                    <footnoteId id="F1"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>A</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>145</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>By Spouse</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
    </nonDerivativeTable>

    <footnotes>
        <footnote id="F1">Pursuant to the terms of the Agreement and Plan of Merger (the &quot;Merger Agreement&quot;), dated as of September 27, 2023, by and between Peoples Financial Services Corp. (&quot;Peoples&quot;) and FNCB Bancorp, Inc. (&quot;FNCB&quot;), on July 1, 2024 (the &quot;Closing Date&quot;) FNCB merged with and into Peoples (the &quot;Merger&quot;), with Peoples continuing as the surviving company of the Merger. Pursuant to the Merger Agreement, on the Closing Date each share of FNCB common stock held by the reporting person was converted into the right to receive 0.1460 of a share of common stock of Peoples rounded down to the nearest whole number of shares.</footnote>
        <footnote id="F2">This amount includes 1,411 shares of time-based restricted common stock solely owned by Mr. Bone; 8,201 shares held jointly with his spouse; 890 shares co-owned with Mr. Bone's father and siblings; and 74 shares owned solely by Mr. Bone.</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>/s/ Stephanie A. Westington, as Attorney-in-Fact for James M. Bone Jr.</signatureName>
        <signatureDate>2024-07-01</signatureDate>
    </ownerSignature>
</ownershipDocument>
