<PAGE>   1

                                                                   EXHIBIT 10.31

                               FIFTH AMENDMENT TO
                     AMENDED AND RESTATED CREDIT AGREEMENT


                 This  Fifth Amendment to Amended and Restated Credit Agreement
(this "Amendment") dated as of June 30, 1998 is among COSTILLA ENERGY, INC., a
Delaware corporation (the "Borrower"), the banks named on the signature pages
hereto (together with their respective successors and assigns in such capacity,
the "Banks"), BANKERS TRUST COMPANY, as agent for the Banks (together with its
successors and assigns in such capacity, the "Agent") and UNION BANK OF
CALIFORNIA, N.A., as co-agent for the Banks (together with its successors and
assigns in such capacity, the "Co-Agent").


                             PRELIMINARY STATEMENT

                 A.       The Borrower and the Bank Group have entered into
that certain Amended and Restated Credit Agreement dated as of August 28, 1997
as amended by that certain First Amendment to Amended and Restated Credit
Agreement dated as of December 30, 1997, that certain Second Amendment to
Amended and Restated Credit Agreement dated as of January 14, 1998,  that
certain Third Amendment to Amended and Restated Credit Agreement dated as of
February 26, 1998 and that certain Fourth Amendment to Amended and Restated
Credit Agreement dated as of March 24, 1998 (as so amended, the "Credit
Agreement").

                 B.       The Borrower and the Bank Group desire to further
amend the Credit Agreement as set forth herein.

                 NOW THEREFORE, in consideration of the foregoing and the
mutual agreements set forth herein, the parties agree as follows:

                 Section 1.  Definitions. Unless otherwise defined in this
Amendment, each capitalized term used in this Amendment has the meaning
assigned to such term in the Credit Agreement.

                 Section 2. Amendments. The Credit Agreement is hereby amended
as follows:

                 Section 6.04 of the Credit Agreement is hereby amended in its
         entirety to read as follows:

                          "Section 6.04.  Interest Coverage Ratio.   The
                 Borrower will not permit the ratio of (a) EBITDA to (b)
                 Interest Expense, measured as of the last day of any calendar
                 quarter for the twelve month period then ended, to be less
                 than (i) 1.75 to 1.00 as of the last day of any calendar
                 quarter through December 31, 1998, (ii) 2.30 to 1.00 as of the
                 last day of any calendar quarter ending during 1999, or (iii)
                 2.50 to 1.00 as of the last day of any calendar quarter after
                 December 31, 1999."
<PAGE>   2
                 Section 3. Purchase of Common Stock. The Bank Group hereby
rescinds the restriction on the Borrower's purchase of the Borrower's common
stock set forth in Section 3 of that certain Limited Waiver dated as of May 13,
1998 among the Borrower and the Bank Group and reinstates the Borrower's right
to purchase the Borrower's common stock to the extent (and only to the extent)
allowed under Section 6.09(c) of the Credit Agreement.

                 Section 4. Ratification. The Borrower hereby ratifies and
confirms all of the Obligations under the Credit Agreement (as amended hereby)
and the other Loan Documents. All references in the Loan Documents to the
"Credit Agreement" shall mean the Credit Agreement as amended hereby and as the
same may be amended, supplemented, restated or otherwise modified and in effect
from time to time in the future.

                 Section 5.  Effectiveness. This Amendment shall become
effective upon the execution of this Amendment by all parties hereto.  This
Amendment may be executed in separate counterparts, all of which constitute one
and the same instrument.

                 Section 6. Representations and Warranties. The Borrower hereby
represents and warrants to the Bank Group that (a) the execution, delivery and
performance of  this Amendment has been duly authorized by all requisite
corporate action on the part of the Borrower, (b) each of the Credit Agreement
(as amended hereby) and the other Loan Documents to which it is a party
constitutes a valid and legally binding agreement enforceable against the
Borrower in accordance with its terms except, as such enforceability may be
limited by bankruptcy, insolvency, reorganization, moratorium, fraudulent
transfer or other similar laws relating to or affecting the enforcement of
creditors' rights generally and by general principles of equity, (c) the
representations and warranties by the Borrower contained in the Credit
Agreement as amended hereby and in the other Loan Documents are true and
correct on and as of the date hereof in all material respects as though made as
of the date hereof,  (d) no Default or Event of Default exists under the Credit
Agreement (as amended hereby) or any of the other Loan Documents.

                 Section 7. Choice of Law. This Amendment shall be governed by,
and construed in accordance with, the laws of the State of New York.

                 Section 8. Final Agreement. THE CREDIT AGREEMENT (AS AMENDED
HEREBY) AND THE OTHER LOAN DOCUMENTS REPRESENT THE FINAL AGREEMENT BETWEEN THE
PARTIES AND MAY NOT BE CONTRADICTED BY EVIDENCE OF PRIOR, CONTEMPORANEOUS OR
SUBSEQUENT ORAL AGREEMENTS OF THE PARTIES. THERE ARE NO ORAL AGREEMENTS BETWEEN
THE PARTIES.





                                      -2-
<PAGE>   3
                 IN WITNESS WHEREOF, the parties hereto have caused this
Amendment to be executed by its officers thereunto duly authorized as of the
date first above written.

                                       COSTILLA ENERGY, INC.
                                   
                                   
                                       By: /s/ Bobby W. Page 
                                           ------------------------------------
                                       Name:                 
                                              ---------------------------------
                                       Title:                
                                               --------------------------------
                                   
                                       BANKERS TRUST COMPANY,
                                             as Agent and Bank
                                   
                                   
                                       By: /s/ Marcus M. Tarkington
                                           ------------------------------------
                                       Name:                       
                                              ---------------------------------
                                       Title:                      
                                               --------------------------------
                                   
                                       UNION BANK OF CALIFORNIA, N.A.,
                                            as Co-Agent and Bank
                                   
                                   
                                       By: /s/ Dustin Gaspari       
                                           ------------------------------------
                                       Name:                        
                                              ---------------------------------
                                       Title:                  
                                               --------------------------------
                                   
                                   
                                       By: /s/ Randall Osterberg
                                           ------------------------------------
                                       Name:                                    
                                              ---------------------------------
                                       Title:                                   
                                               --------------------------------
                                                                               
                                                                               
                                       DEN NORSKE BANK ASA,                    
                                            as Bank                            
                                                                               
                                                                               
                                       By: /s/ Charles E. Hall
                                           ------------------------------------
                                       Name:                                    
                                              ---------------------------------
                                       Title:                                   
                                               --------------------------------
                                                                               
                                                                               
                                       By: /s/ J. Morten Kreutz                
                                           ------------------------------------ 
                                       Name:                                    
                                              --------------------------------- 
                                       Title:                                  
                                               --------------------------------


                                       WELLS FARGO BANK (TEXAS), N.A.,
                                            as Bank
                                       
                                       
                                       By: /s/ Lester J.N. Keliher             
                                           ------------------------------------
                                       Name:                                   
                                              ---------------------------------
                                       Title:                                  
                                               --------------------------------
                                       



                                     -3-