Chazal instituted that, in some situations at least, a daughter should inherit (Gemara Ketubos 68a):
אמר רבי בת הניזונת מן האחין נוטלת עישור נכסים
Rabbi Yehuda HaNasi said: With regard to an orphan daughter who is sustained from the inheritance held by her brothers, she takes one-tenth of the estate for her dowry.
(As was pointed out to me on the comments by Avi Kamenetsky, this is actually putting a debt upon the inherited property, not giving an outright gift to the daughter as if it were an immediate inheritance. This is to make the dowry more similar to the standard practice from that time. A father would normally give a large dowry to his son-in-law upon marriage, guaranteed in the ketuba/marriage contract that it goes back to the daughter in case of the husband's death or divorce.)
We learn in the Mishnah (Baba Basra 8:5):
הַכּוֹתֵב אֶת נְכָסָיו לַאֲחֵרִים וְהִנִּיחַ אֶת בָּנָיו, מַה שֶּׁעָשָׂה עָשׂוּי, אֲבָל אֵין רוּחַ חֲכָמִים נוֹחָה הֵימֶנּוּ. רַבָּן שִׁמְעוֹן בֶּן גַּמְלִיאֵל אוֹמֵר, אִם לֹא הָיוּ בָנָיו נוֹהֲגִין כַּשּׁוּרָה, זָכוּר לְטוֹב:
If a man wrote away his property to others and passed over his sons, what he has done is done, but the Sages are not comfortable with it. Rabban Shimon ben Gamaliel says: “If has sons did not behave properly, it should be counted to his credit.”
It would seem from here that there is no problem with dividing up an inheritance, only with taking away the entire inheritance from the sons, and even that could be justified in extreme cases. (See the commentators there as to what constitutes inappropriate behavior.)
As to the spirit of the law, it would seem from the end of Bamidbar that the purpose of giving the inheritance to sons and not daughters is to maintain tribal purity in the division of Eretz Yisroel.
As to a source for how to give a will like we described, the mishna previously quoted:
הָאוֹמֵר אִישׁ פְּלוֹנִי בְנִי בְּכוֹר לֹא יִטֹּל פִּי שְׁנַיִם, אִישׁ פְּלוֹנִי בְנִי לֹא יִירַשׁ עִם אֶחָיו, לֹא אָמַר כְּלוּם, שֶׁהִתְנָה עַל מַה שֶּׁכָּתוּב בַּתּוֹרָה. הַמְחַלֵּק נְכָסָיו לְבָנָיו עַל פִּיו, רִבָּה לְאֶחָד וּמִעֵט לְאֶחָד וְהִשְׁוָה לָהֶן אֶת הַבְּכוֹר, דְּבָרָיו קַיָּמִין. וְאִם אָמַר מִשּׁוּם יְרֻשָּׁה, לֹא אָמַר כְּלוּם. כָּתַב בֵּין בַּתְּחִלָּה בֵּין בָּאֶמְצַע בֵּין בַּסּוֹף מִשּׁוּם מַתָּנָה, דְּבָרָיו קַיָּמִין. הָאוֹמֵר אִישׁ פְּלוֹנִי יִירָשֵׁנִי בִּמְקוֹם שֶׁיֵשׁ בַּת, בִּתִּי תִירָשֵׁנִי בִּמְקוֹם שֶׁיֶּשׁ בֵּן, לֹא אָמַר כְּלוּם, שֶׁהִתְנָה עַל מַה שֶּׁכָּתוּב בַּתּוֹרָה.
If a man says, “So and so, my firstborn son, shall not receive a double portion”, or “So and so, my son, shall not inherit with his brothers”, he has said nothing, for he has made a condition contrary to what is written in the Torah. If a man apportioned his property to his sons by word of mouth, and gave much to one and little to another, or made them equal to the firstborn, his words are valid. But if he had said [that it should be so] “by inheritance”, he has said nothing. If he had written down, whether at the beginning or in the middle or at the end [of his will] that it should be as a gift, his words are valid. If a man said, “So and so a man shall inherit from me” and he has a daughter; or “My daughter shall inherit from me”, and he has a son, he has said nothing, for he has made a condition contrary to what is written in the Torah.
In other words, you can't change inheritance very much, but you can give a gift however you want.
As to the details of how to write a halachicly acceptable will, CYLOR.