Without the injection of fresh funding, the Ibrox outfit would not have been able to cover pay checks due to be delivered on Thursday.
The loan will be secured against Murray Park, Edmiston House, Albion Car Park, and the Club's registered trademarks - but not Ibrox.
The move spells the end of attempts by the Three Bears - wealthy fans Douglas Park, George Letham and George Taylor - to have their own loan offer accepted.
It was their promise to match Ashley's deal whilst demanding Ibrox remained unsecured that forced the Newcastle United owner to drop the stadium from the terms of his agreement.
In return for the money - which will be paid to Rangers in two £5million tranches - Ashley will be able to nominate two more directors to the Light Blues board. His associates Derek Llambias and Barry Leach are already serving as chief executive and financial director.
As well as that, Rangers will transfer 26 per cent of its holding in Rangers Retail Ltd (RRL).
RRL was a joint venture set up by the club and Sports Direct, with Rangers in control of 51 per cent and Ashley's company controlling the rest. Fans, however, were already concerned that it was overly beneficial to Ashley.
Now as part of the new loan deal, the club has also agreed that from the 2017/8 season, for the duration of the loan, any future shirt sponsorship proceeds "will be for the benefit of RRL".
In a lengthy 7am statement to the Stock Exchange, the board said: "The Board of Rangers announces that Rangers Football Club Limited has entered in to agreements with SportsDirect.com Retail Limited and associated companies, to provide a long term on-going credit facility of up to £10m.
"The Company's financial condition has been perilous for a number of months exacerbated by lower than expected match attendances. The Directors have implemented a cost cutting program with which they have made significant progress.
"There is however an immediate need for a substantial injection of capital, and the Directors have considered a number of options.
"The terms negotiated with SD (which are reversible in respect of the Facility) represent the optimum combination of quantum and duration of funding, allowing the Company time to arrange permanent capital which can be used for strengthening the playing squad.
"The Facility is structured in two separate interest free tranches. £5million will be available immediately for working capital purposes and for the repayment of the credit facilities with MASH Holdings Limited which was entered into on 27 October 2014.
"All rights and security associated with the MASH facility will be cancelled.
"The Club will transfer 26 per cent of the share capital in Rangers Retail Limited to SD for the duration of the Facility, which will be transferred back, at no cost, upon repayment of all outstanding sums owed by Rangers and its subsidiaries to SD. There is no specified repayment period for the first tranche of the Facility.
"The Facility is to be secured by (1) a floating charge over the Club's assets and (2) fixed charges over Murray Park, Edmiston House, Albion Car Park, and the Club's registered trademarks.
"None of the security that is being given to SD covers Ibrox Stadium, which is specifically excluded and remains in the full ownership of the Club, free from any security.
"SD will also have the right to nominate two directors to the board of Rangers for the duration of the Facility, any such nomination will be subject to regulatory consent pursuant to the AIM Rules and other regulatory bodies.
"If the entire sum drawn down is repaid, the Facility will be deemed to be terminated, all security will be released, the 26 per cent of RRL will revert to the Company and all rights of SD to nominate Directors to the Board of the Company will cease.
"The second tranche of £5million, which repayable five years after drawn down, will be used, if required, for working capital purposes and is subject to due diligence by SD prior to drawn down.
"The Company has also agreed that from the 2017/8 season, for the duration of the Facility, any future shirt sponsorship proceeds will be for the benefit of RRL.
"RRL will declare a dividend of a total of £1,610,000 prior to the Transfer.
"The Club will use the proceeds of its share of this dividend, inter alia, to repay sums owing to SD in respect of the cessation of onerous leases on unprofitable stores entered into by a previous Rangers management team.
"The Directors would like to thank all the Rangers Stakeholders who showed an interest in helping the Company."
Chairman David Somers said: "The Board has sought for some time to establish a long term funding solution for the Company in order to create a platform of stability to build for the future.
"This Facility begins this process and we very much hope that it will be augmented with further permanent capital in due course.
"In addition, the executive team have made strides in addressing the cost base of the Company in order to improve our financial condition and working capital profile.
"We very much hope that we can now move away from having to seek short term funding solutions and can focus our efforts towards investing in the first team playing squad, a return to profitability and to re-establishing Rangers in the top league in Scottish Football and in due course, to European competition.
"The Board now calls upon all shareholders to rally together to achieve this goal."
Ashley has now strengthened his grasp on the money streams entering the club, but the balance of power could yet swing away from him in the coming weeks if Dave King succeeds in routing the board at the general meeting he has called.