Diarra has not played for Fulham since December 2012 due to a serious knee injury.
The 32-year-old's contract expired in the summer but he has been training with the club in a bid to prove his fitness.
Cottagers boss Felix Magath, who replaced Rene Meulensteen last month, has been impressed enough to offer the midfielder a short-term deal as he attempts to keep the club in the top-flight.
"The club is delighted to announce that Mahamadou Diarra has rejoined Fulham on a deal that will run until the end of the 2013/14 season," a statement read on Fulham's official website.
"The 32-year-old was out of action for a sustained period after struggling with a knee injury, but worked relentlessly to regain full fitness. Diarra's short-term contract with Fulham will see his remuneration based on the number of appearances he makes for the First Team.
"The former Real Madrid midfielder initially joined the Whites on a free transfer in February 2012 and he went on to make 19 appearances for the club, scoring once."
With just seven games remaining, Fulham are four points from safety and face Champions League-chasing Everton at Craven Cottage on Sunday before taking on Aston Villa and Norwich.