Exhibit 4.18

      

      

      

      SECOND AMENDMENT TO CREDIT AND GUARANTY AGREEMENT, dated as of August 2, 2019 (this "Amendment"), among (i) Atlantica Yield PLC, as borrower (the "Borrower")
            under the Credit and Guaranty Agreement, dated as of May 10, 2018 (as amended, amended and restated, supplemented or otherwise modified from time to time, the "Credit Agreement"), among the Borrower, the Guarantors, the L/C Issuers, the Lenders and the Administrative Agent (each as defined below), (ii) the guarantors party to the Credit Agreement (the "Guarantors"), (iii) Royal Bank of Canada and Canadian Imperial Bank of Commerce, London Branch, as L/C Issuers (the "L/C Issuers"), (iv) the lenders party to the Credit Agreement (the "Lenders") and (v) Royal Bank of Canada, as administrative agent for
            the Lenders (in such capacity, the "Administrative Agent").

      

      

      WHEREAS, the Borrower has requested the Administrative Agent and the Lenders to (i) extend the Maturity Date (as defined in the Credit Agreement) to December 31, 2022 and (ii) increase the
        Aggregate Commitments by an amount of U.S.$125,000,000 (the "New Commitments"), and the Lenders are agreeable to such request upon the terms and subject to the conditions set forth herein.

      

      

      NOW THEREFORE, in consideration of the premises and the agreements, provisions and covenants set forth herein, the parties hereto agree as follows:

      

      

      ARTICLE I

       

      RATIFICATION; DEFINITIONS AND RULES OF CONSTRUCTION

      

      

      Section 1.1          Relation to Credit Agreement; Ratification.  This Amendment is entered into in accordance with Section 11.01
          of the Credit Agreement and constitutes an integral part of the Credit Agreement.  Except as amended by this Amendment, the provisions of the Credit Agreement are in all respects ratified and confirmed and shall remain in full force and effect.

      

      

      Section 1.2          Definitions.  Unless otherwise defined herein, terms defined in the Credit Agreement (as amended by this
          Amendment) are used herein as therein defined, and the rules of interpretation set forth in Section 1.02 of the Credit Agreement shall apply mutatis mutandis to this Amendment.

       

      ARTICLE II

       

      AMENDMENT TO CREDIT AGREEMENT

      

      

      Section 2.1          Amendment to Credit Agreement.  The parties hereto hereby agree that, effective as of the Amendment No. 2
          Effective Date (as defined below),

       

      (a)          Section 1.01 of the Credit Agreement is hereby amended by,

       

      (i)          adding the definition of the following terms in the corresponding alphabetical order:

       

      
        

        
          


      

      
      ""Amendment No. 2 Effective Date" shall have the
          meaning ascribed to such term in the Second Amendment to Credit and Guaranty Agreement.

       

      "BHC Act Affiliate" of a party means an “affiliate” (as such term is defined under, and interpreted in accordance with, 12 U.S.C. 1841(k)) of such
        party.

       

      "Covered Entity" means any of the following:  (i) a "covered entity" as that term is defined in, and interpreted in accordance with, 12 C.F.R. §
        252.82(b); (ii) a "covered bank" as that term is defined in, and interpreted in accordance with, 12 C.F.R. § 47.3(b); or (iii) a "covered FSI" as that term is defined in, and interpreted in accordance with, 12 C.F.R. § 382.2(b).

       

      "Default Right" has the meaning assigned to that term in, and shall be interpreted in accordance with, 12 C.F.R. §§ 252.81, 47.2 or 382.1, as
        applicable.

       

      "QFC" has the meaning assigned to the term "qualified financial contract" in, and shall be interpreted in
        accordance with, 12 U.S.C. 5390(c)(8)(D).

       

      "Reduction Date" means December 31, 2021.

       

      "Second Amendment to Credit and Guaranty Agreement" means the Second Amendment to Credit and Guaranty Agreement, dated as of August 2, 2019, among the Borrower, the Guarantors, the Lenders, the L/C Issuers and the Administrative Agent.

       

      "Specified Commitments" means the used and unused Commitments as of the Amendment No. 2 Effective Date of all Specified Lenders (as adjusted as a result of a Commitment reduction pursuant to Section 2.05(a) or the assignment thereof pursuant to Section 11.06).

       

      "Specified Lenders" means BARCLAYS BANK PLC, in its capacity as Lender as of the Amendment No. 2 Effective Date, and any permitted assignee thereof of its rights and obligations in respect of its Specified Commitment and its Loans
          associated therewith."

       

      (ii)          replacing the definition of the term "Maturity Date" in its entirety with the following:

       

      ""Maturity Date" means December 31, 2022."

       

      
        

        2

        
          


      

      (b)          Section 2.04(b) of the Credit Agreement is hereby amended by adding the following new clause (v) at the end thereof:

       

      "(v) Anything herein to the contrary notwithstanding, including Section 2.04(b)(iv), on the Reduction Date the Borrower shall prepay in full, and without
          duplication, all Loans made or acquired, as applicable, by the Specified Lenders, but solely in respect of the Specified Commitments, and that remain outstanding on such date, together with all other Obligations owed to the Specified Lenders in
          respect thereof; and any prepayment made by the Borrower in accordance with this Section 2.04(b)(v) shall be applied to the prepayment of such Loans only (and not as set forth under clause (iv) above), and the Specified Lenders shall not be
          required to share any portion of such prepayment with any other Lender or L/C Issuer pursuant to Section 2.12.  All Lenders and L/C Issuers hereby agree and acknowledge to the foregoing."

       

      (c)          Section 2.05 of the Credit Agreement is hereby amended by adding the following new paragraph at the end of clause (b) thereof:

       

      "Anything herein to the contrary notwithstanding, the Specified Commitments shall be automatically and permanently terminated on the date which is ten days prior
          to the Reduction Date, and the Availability Period solely in respect of the Specified Commitments shall be deemed expired on such date."

       

      (d)          Section 2.05(c) of the Credit Agreement is hereby amended by deleting it in its entirety and replacing it with the following:

      

      

      "(c)          Application of Commitment Reductions; Payment of Fees. The Administrative Agent
          will promptly notify the Lenders of any termination or reduction of the Commitments under this Section 2.05.  Upon any reduction of the Commitments (other than a reduction of the Specified Commitments pursuant to Section 2.05(b)), the Commitment
          of each Lender shall be reduced by such Lender's Applicable Percentage of such reduction amount. All fees in respect of the Facility accrued until the effective date of any termination of the Facility shall be paid on the effective date of such
          termination."

       

      (e)          Section 2.12 of the Credit Agreement is hereby amended by deleting clause (ii) of the proviso thereto and replacing it in its
          entirety with the following:

       

      "(ii) the provisions of this Section shall not be construed to apply to (x) any payment made by or on behalf of the Borrower pursuant to and in accordance with the express terms of
          this Agreement (including the application of funds arising from the existence of a Defaulting Lender or the application of funds pursuant to Section 2.04(b)(v)), or (y) any payment obtained by a Lender as consideration for the assignment of or
          sale of a participation in any of its Loans to any assignee or participant, other than an assignment to the Borrower or any Affiliate thereof (as to which the provisions of this Section shall apply)."

       

      

      
        

        3

        
          


      

      (f)          Section 11.01 of the Credit Agreement is hereby amended by adding the following new paragraph at the end thereof:

       

      "Notwithstanding anything to the contrary herein, any amendment, waiver or consent in connection with (a) any of the following terms: "Amendment No. 2 Effective
          Date," "Reduction Date," "Second Amendment to Credit and Guaranty Agreement," "Specified Commitments" or "Specified Lenders" or (b) Section 2.04(b)(v), the last paragraph of Section 2.05(b), Section 2.05(c), clause (ii) of the proviso to Section
          2.12 or this paragraph, shall not be effective unless in writing signed by the Required Lenders, the Specified Lenders and the Borrower."

       

      (g)          Article XI of the Credit Agreement is hereby amended by adding the following new Section 11.23 (Acknowledgement Regarding Any Supported QFCs) at the end thereof:

       

      "11.23 Acknowledgement Regarding Any Supported QFCs. To the extent that
          the Loan Documents provide support, through a guarantee or otherwise, for any Swap Contract or any other agreement or instrument that is a QFC (such support, “QFC Credit Support”, and each such QFC, a “Supported QFC”), the parties acknowledge and agree as follows with respect to the resolution power of
          the Federal Deposit Insurance Corporation under the Federal Deposit Insurance Act and Title II of the Dodd-Frank Wall Street Reform and Consumer Protection Act (together with the regulations promulgated thereunder, the “U.S. Special Resolution Regimes”) in respect of such Supported QFC and QFC Credit Support (with the provisions below applicable notwithstanding that the Loan Documents
          and any Supported QFC may in fact be stated to be governed by the laws of the State of New York and/or of the United States or any other state of the United States):

       

      In the event a Covered Entity that is party to a Supported QFC (each, a “Covered Party”) becomes subject to a proceeding under a U.S. Special Resolution Regime, the transfer of such Supported QFC and the benefit of such QFC Credit
          Support (and any interest and obligation in or under such Supported QFC and such QFC Credit Support, and any rights in property securing such Supported QFC or such QFC Credit Support) from such Covered Party will be effective to the same extent
          as the transfer would be effective under the U.S. Special Resolution Regime if the Supported QFC and such QFC Credit Support (and any such interest, obligation and rights in property) were governed by the laws of the United States or a state of
          the United States. In the event a Covered Party or a BHC Act Affiliate of a Covered Party becomes subject to a proceeding under a U.S. Special Resolution Regime, Default Rights under the Loan Documents that might otherwise apply to such Supported
          QFC or any QFC Credit Support that may be exercised against such Covered Party are permitted to be exercised to no greater extent than such Default Rights could be exercised under the U.S. Special Resolution Regime if the Supported QFC and the
          Loan Documents were governed by the laws of the United States or a state of the United States. Without limitation of the foregoing, it is understood and agreed that rights and remedies of the parties with respect to a Defaulting Lender shall in
          no event affect the rights of any Covered Party with respect to a Supported QFC or any QFC Credit Support."

       

        

      
        

        4

        
          


      

      (h)          Schedule 2.01 of the Credit Agreement is hereby amended by replacing it in its entirety with Annex I hereto; provided that, for all purposes under the Credit Agreement:

       

      (i)          "New Commitments" shall mean the increase to the Commitments pursuant to the terms hereof,
          and the term "New Commitments" under Section 1.01 of the Credit Agreement shall be deemed amended accordingly; and

       

      (ii)          "New Loan" shall mean each Loan made under the New Commitments, and the term "New Loans"
          under Section 1.01 of the Credit Agreement shall be deemed amended accordingly.

       

      ARTICLE III

       

      CONDITIONS TO EFFECTIVENESS; OTHERS

      

      

      Section 3.1          Conditions to Effectiveness.  This Amendment shall become effective on the date each of the following conditions
          precedent is satisfied (such date, the "Amendment No. 2 Effective Date"): (a) the Administrative Agent has received a true, correct and complete copy of this Amendment, duly executed and delivered by a duly authorized officer of each party
          hereto and (b) the Administrative Agent has received evidence that the Borrower, as pledgor, and ABY Concessions Infrastructures, S.L.U., as company, under each Initial Pledge Agreement governed by Spanish Law, have entered into each public or
          private documents as may be necessary to formalize the extension and ratification of such Initial Pledge Agreements in connection with the amendments to the Credit Agreement set forth herein.

      

      

      Section 3.2          Increase in Commitments.  The parties hereto hereby agree and acknowledge that, after the Amendment  No. 2
          Effective Date, the Borrower shall no longer be entitled to exercise any rights under Section 2.14 of the Credit Agreement to request an increase to the Commitments.

       

        

      
        

        5

        
          


      

      ARTICLE IV

       

      REPRESENTATIONS AND WARRANTIES

       

      Section 4.1          Representations and Warranties.  Each Loan Party represents and warrants to the Secured Parties as of the
          Amendment No. 2 Effective Date, that:

       

      (a)          Authorization; No Contravention.  The execution, delivery and performance by each Loan Party of this Amendment has been
          duly authorized by all necessary corporate or other organizational action, and do not and will not: (i) contravene the terms of any of such Person's Organization Documents; (ii) conflict with or result in any breach or contravention of, or the
          creation of any Lien under, or require any payment to be made under (A) any Contractual Obligation to which such Person or any of its Subsidiaries is a party or affecting such Person or any of its Subsidiaries or the properties of such Person or
          any of its Subsidiaries or (B) any order, injunction, writ or decree of any Governmental Authority or any arbitral award to which such Person or any of its Subsidiaries or the properties of such Person or any of its Subsidiaries is subject; or
          (c) violate any Law.

       

      (b)          Binding Effect.  This Amendment has been duly executed and delivered by each Loan Party that is party hereto.  Subject
          to the Legal Reservations, this Amendment constitutes a legal, valid and binding obligation of such Loan Party, enforceable against each Loan Party that is party thereto in accordance with its terms.

       

      (c)          UK Initial Pledge Agreements. The Lien created by the Borrower pursuant to the Initial Pledge Agreement governed by
          English Law shall (a) remain in full force and effect notwithstanding the amendments referred to in Section 2.1 (Amendment to Credit Agreement) above and (b) continue to secure the Secured Obligations.

       

      ARTICLE V

       

      MISCELLANEOUS

      

      

      Section 5.1          Notices.  All notices, requests and other communications to any party hereto shall be given or served in the
          manner contemplated in Section 11.02 of the Credit Agreement.

      

      

      Section 5.2          No Waiver; Status of Loan Documents.  This Amendment shall not
          constitute an amendment, supplement or waiver of any provision of the Credit Agreement not expressly referred to herein and shall not be construed as an amendment, supplement, waiver or consent to any action on the part of any party hereto that
          would require an amendment, supplement, waiver or consent of the Lenders except as expressly stated herein. Except as expressly amended, supplemented or waived hereby, the provisions of the Credit Agreement are and shall remain in full force and
          effect.  No failure or delay on the part of the Lenders in the exercise of any power, right or privilege hereunder or under any other Loan Document shall impair such power, right or privilege or be construed to be a waiver of any default or
          acquiescence therein, nor shall any single or partial exercise of any such power, right or privilege preclude other or further exercise thereof or of any other power, right or privilege. All rights and remedies existing under this Amendment and
          the other Loan Documents are cumulative to, and not exclusive of, any rights or remedies available at equity or law.  Nothing in this Amendment shall constitute a novation of the Loan Parties' obligations under the Credit Agreement or any other
          Loan Document.

       

        

      
        

        6

        
          


      

      Section 5.3          Amendment.  This Amendment may be amended, waived, discharged or terminated only by an instrument in writing
          signed by the party against which enforcement of such change, waiver, discharge or termination is sought.

      

      

      Section 5.4          Amendment Binding.  This Amendment shall be binding upon and inure to the benefit of and be enforceable by the
          parties hereto and the respective successors and permitted assigns of the parties hereto.

      

      

      Section 5.5          Headings.  Section headings used herein are for convenience of reference only, are not part of this Amendment and
          shall not affect the construction of, or be taken into consideration in interpreting, this Amendment.

      

      

      Section 5.6          Governing Law.

      

      

      (a)          This Amendment shall be governed by, and construed in accordance with, the laws of the State of New York.

      

      

      (b)          Each of the undersigned hereto agrees that any dispute relating to this Amendment shall be determined in accordance with Sections


            11.14 and 11.15 of the Credit Agreement and the provisions of said Sections 11.14 and 11.15 of the Credit Agreement are incorporated herein by reference.

      

      

      Section 5.7          Counterparts. This Amendment may be executed in counterparts (and by different parties hereto in different
          counterparts), each of which shall constitute an original, but all of which when taken together shall constitute a single contract.  Delivery of an executed counterpart of a signature page of this Amendment by e-mail in portable document format
          (.pdf) or facsimile (with acknowledgment of receipt) will be effective as delivery of a manually executed counterpart of this Amendment.

      

      

      [Remainder of this page intentionally left blank]

      

      

      
        

        7

        
          


        
          	
                  Signature Page

                  Amendment No. 2 to Credit and Guaranty Agreement

                


        

      

       

      IN WITNESS WHEREOF, the parties have caused this Amendment to be duly executed and delivered as of the day and year first above written.

      

      

      
        	
                 

              	
                Yours truly,

              


      

      

      

      	 	
              ATLANTICA YIELD PLC,

            
	 	
              as the Borrower

            
	 	 	 
	 	
              By:

            	 
	 	
              Name:

            	 
	 	
              Title:

            	 


      

      

      
        

        
          


        
          	
                  Signature Page

                  Amendment No. 2 to Credit and Guaranty Agreement

                


        

      

      	 	
              ABY CONCESSIONS

            
	 	
              INFRASTRUCTURES S.L.U.,

            
	 	
              as a Guarantor

            
	 	 	 
	 	
              By:

            	 
	 	
              Name:

            	 
	 	
              Title:

            	 


      

      

      
        

        
          


        
          	
                  Signature Page

                  Amendment No. 2 to Credit and Guaranty Agreement

                


        

      

      	 	
              ABY CONCESSIONS PERU S.A.,

            
	 	
              as a Guarantor

            
	 	 	 
	 	
              By:

            	 
	 	
              Name:

            	 
	 	
              Title:

            	 


       

      

      
        

        
          


        
          	
                  Signature Page

                  Amendment No. 2 to Credit and Guaranty Agreement

                


        

      

      	 	
              ACT HOLDING, S.A. DE C.V.,

            
	 	
              as a Guarantor

            
	 	 	 
	 	
              By:

            	 
	 	
              Name:

            	 
	 	
              Title:

            	 


      

      

      
        

        
          


        
          	
                  Signature Page

                  Amendment No. 2 to Credit and Guaranty Agreement

                


        

      

      	 	
              ASHUSA INC.,

            
	 	
              as a Guarantor

            
	 	 	 
	 	
              By:

            	 
	 	
              Name:

            	 
	 	
              Title:

            	 


      

      

      
        

        
          


        
          	
                  Signature Page

                  Amendment No. 2 to Credit and Guaranty Agreement

                


        

      

      	 	
              ASUSHI INC.,

            
	 	
              as a Guarantor

            
	 	 	 
	 	
              By:

            	 
	 	
              Name:

            	 
	 	
              Title:

            	 


      

      

      
        

        
          


        
          	
                  Signature Page

                  Amendment No. 2 to Credit and Guaranty Agreement

                


        

      

      	 	
              ATLANTICA YIELD SOUTH AFRICA

            
	 	
              LIMITED,

            
	 	
              as a Guarantor

            
	 	 	 
	 	
              By:

            	 
	 	
              Name:

            	 
	 	
              Title:

            	 


      

      

      
        

        
          


        
          	
                  Signature Page

                  Amendment No. 2 to Credit and Guaranty Agreement

                


        

      

      	 	
              ROYAL BANK OF CANADA,

            
	 	
              as Administrative Agent

            
	 	 	 
	 	
              By:

            	 
	 	
              Name:

            	 
	 	
              Title:

            	 


      

      

      
        

        
          


        
          	
                  Signature Page

                  Amendment No. 2 to Credit and Guaranty Agreement

                


        

      

      	 	
              ROYAL BANK OF CANADA,

            
	 	
              as Lender and L/C Issuer

            
	 	 	 
	 	
              By:

            	 
	 	
              Name:

            	 
	 	
              Title:

            	 


      

      

      
        

        
          


        
          	
                  Signature Page

                  Amendment No. 2 to Credit and Guaranty Agreement

                


        

      

      	 	
              CANADIAN IMPERIAL BANK OF COMMERCE,

            
	 	
              LONDON BRANCH,

            
	 	
              as Lender and L/C Issuer

            
	 	 	 
	 	
              By:

            	 
	 	
              Name:

            	 
	 	
              Title:

            	 


      

      

      
        

        
          


        
          	
                  Signature Page

                  Amendment No. 2 to Credit and Guaranty Agreement

                


        

      

      	 	
              BANCO SANTANDER, S.A., NEW YORK BRANCH

            
	 	
              as Lender

            
	 	 	 
	 	
              By:

            	 
	 	
              Name:

            	 
	 	
              Title:

            	 


      

      

      
        

        
          


        
          	
                  Signature Page

                  Amendment No. 2 to Credit and Guaranty Agreement

                


        

      

      	 	
              BARCLAYS BANK PLC,

            
	 	
              As Specified Lender

            
	 	 	 
	 	
              By:

            	 
	 	
              Name:

            	 
	 	
              Title:

            	 


      

      

      
        

        
          


        
          	
                  Signature Page

                  Amendment No. 2 to Credit and Guaranty Agreement

                


        

      

      	 	
              JPMORGAN CHASE BANK, N.A.,

            
	 	
              as Lender

            
	 	 	 
	 	
              By:

            	 
	 	
              Name:

            	 
	 	
              Title:

            	 


      

      

      
        

        
          


        
          	
                  Signature Page

                  Amendment No. 2 to Credit and Guaranty Agreement

                


        

      

      	 	
              MUFG BANK, LTD.,

            
	 	
              as Lender

            
	 	 	 
	 	
              By:

            	 
	 	
              Name:

            	 
	 	
              Title:

            	 


      

      

      
        

        
          


        
          	
                  Signature Page

                  Amendment No. 2 to Credit and Guaranty Agreement

                


        

      

      	

            	
              BANK OF AMERICA, N.A.,

            
	 	
              as Lender

            
	 	 	 
	 	
              By:

            	 
	 	
              Name:

            	 
	 	
              Title:

            	 


      

      

      
        

        
          


        
          	
                  Signature Page

                  Amendment No. 2 to Credit and Guaranty Agreement

                


        

      

      	 	
              BANK OF MONTREAL, LONDON BRANCH,

            
	 	
              as Lender

            
	 	 	 
	 	
              By:

            	 
	 	
              Name:

            	 
	 	
              Title:

            	 


      

      

      
        

        
          


      

      Annex I

       

      SCHEDULE 2.01

       

      COMMITMENTS, APPLICABLE PERCENTAGES AND HMRC DT TREATY PASSPORT

      SCHEME INFORMATION

      

      

      	
              Lender

            	
              Applicable Percentage

            	
              Commitment

            	
              HMRC DT Treaty

              Passport Scheme

              Reference Number

            	
              Jurisdiction

              of Tax

              Residence

            
	
              ROYAL BANK OF CANADA

            	
              14.71%

            	
              US$62,500,000

            	
              3/R/70780/DTTP

            	
              Canada *

            
	
              CANADIAN IMPERIAL BANK OF COMMERCE, LONDON BRANCH

            	
              14.71%

            	
              US$62,500,000

            	
              --

            	
              Canada**

            
	
              BANCO SANTANDER, S.A., NEW YORK BRANCH

            	
              11.76%

            	
              US$50,000,000

            	
              9/S/267974/DTTP

            	
              Spain

            
	
              BARCLAYS BANK PLC

            	
              8.82%

            	
              US$37,500,000

            	
              --

            	
              United Kingdom *

            
	
              JPMORGAN CHASE BANK, N.A.

            	
              11.76%

            	
              US$50,000,000

            	
              13/M/268710/DTTP

            	
              United States

            
	
              BANK OF AMERICA, N.A.

            	
              11.76%

            	
              US$50,000,000

            	
              13/B/7418/DTTP

            	
              United States

            
	
              MUFG BANK, LTD.

            	
              11.76%

            	
              US$50,000,000

            	
              43/B/322072/DTTP

            	
              Japan*

            
	
              Bank of Montreal, London Branch

            	
              14.71%

            	
              US$62,500,000

            	
              3/M/270436/DTTP

            	
              Canada**

            


      

      

      * Jurisdiction of Lending Office: New York, USA

      ** Jurisdiction of Lending Office: London, UK